614 shaares
Why?! Seriously guys…
So this is an piece of my code :
messages = {'chooseYourLang': {'fr': 'Saisis {} pour le français.', 'en': 'Type {} for the English.'}}
langs = ('fr', 'en')
# This…
for n, (code, msg) in enumerate(messages['chooseYourLang'].items(), 1):
print('{}. [{}] {}'.format(n, code.upper(), msg.format(n)))
# Always become that!!
print('\n'.join('{}. [{}] {}'.format(n, lang.upper(), messages['chooseYourLang'][lang].format(n)) for n, lang in enumerate(langs, 1)))
# I just wanted to have it always in this order (fr then en) without needing to use collections.OrderedDict
Fine for me though (more or less)…
So I guess my answer to my own question could be "Just cause I can!" but I don't know… It -always- just happens suddenly, without a warning. Weird.
Do you understand me? Do you share this with me? Am I alone on this planet? Why are we? Who am I? Maybe I should take a break :D
So this is an piece of my code :
messages = {'chooseYourLang': {'fr': 'Saisis {} pour le français.', 'en': 'Type {} for the English.'}}
langs = ('fr', 'en')
# This…
for n, (code, msg) in enumerate(messages['chooseYourLang'].items(), 1):
print('{}. [{}] {}'.format(n, code.upper(), msg.format(n)))
# Always become that!!
print('\n'.join('{}. [{}] {}'.format(n, lang.upper(), messages['chooseYourLang'][lang].format(n)) for n, lang in enumerate(langs, 1)))
# I just wanted to have it always in this order (fr then en) without needing to use collections.OrderedDict
Fine for me though (more or less)…
So I guess my answer to my own question could be "Just cause I can!" but I don't know… It -always- just happens suddenly, without a warning. Weird.
Do you understand me? Do you share this with me? Am I alone on this planet? Why are we? Who am I? Maybe I should take a break :D