samedi 9 octobre 2021

String equivalency or list equivalency or no equivalency in Python

Let's say I have the following code:


customer_a_locale = 'kr'

our_locales = [kr, en]

for each in customer_a_locale:
    if each in our_locales: # don't know how to handle list case
          # return doc in each's locale

    if check = all(item in customer_a_locale for item in our_locales):
          for locales in _all_locales_from_check_:
              return all docs for in customer_a_locale
    else:
          our_locales.insert(-1, _all_outside_check)
          # translate from en our_locales to _all_outside_check_ locale and return docs

This seems clunky and doesn't do what I was expecting. Where have I gone astray from the Pythonic path?

Aucun commentaire:

Enregistrer un commentaire