Frankly I don't see the point.
What does::
f = CharField(choices=LIST)
have over::
f = CharField(choices=zip(LIST, LIST))
?
Jacob
Russell's comments about it being an edge-case and particularly broken
with respect to localization are key points here. The proposal cannot
stand on its own without addressing those.
In any case, I'm with Jacob and Russell on being a strong -1 here. It's
a dozen extra characters of very standard Python if you want to do this
in your own code. Not worth adding to Django's core, along with all the
accompanying documentation and regression testing and maintenance.
Regards,
Malcolm
OK, thanks for the reply and comment. I'll stick to zips then and look
for some other small thing I could try to patch.
Best regards
--
Filip Gruszczyński
By "hurts" you mean "improves". Having long lines of nested computations
is not particularly nice style for Python readability (it works in other
languages where nested calls are commonplace, but it's not particularly
normal in Python). Assign to a constant and you'll be able to tell from
looking at the code that the data comes from a constant defined
elsewhere in this file (or which file it is defined in if it refers to
<module_name>.<constant_name>).
Also, the elephant in the room here is that this whole proposal is a
somewhat bad programming pattern. The choice value should be unchanging.
The choice display string can and often does change. If you use the
automatically use the same value for both and don't write it out that
way, you cannot change the values once you include them.
Regards,
Malcolm