On Aug 9, 8:41 am, andybak <[email protected]> wrote:
> It does get slightly uglier when you have cases such as:
> f = CharField(choices=zip
> (some_complex_expression_that_generates_a_list,
> some_complex_expression_that_generates_a_list))
>
> You don't really want to assign the expression to a variable within
> your model and if you put it elsewhere then it hurts readability
> somewhat.
>
> I doubt that this is sufficient to sway anyone but I thought I'd throw
> in my +0.5 ;-)

In your example a better way is:
f = CharField(choices = [(x, x) for x in some_complex_expression])
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to