On Mon, Nov 2, 2009 at 9:57 AM, David De La Harpe Golden <
david.delaharpe.gol...@ichec.ie> wrote:

>
> Karen Tracey wrote:
> > Commas are good on the ends of elements in a sequence, they are not
> > good here.
>
> Indeed, a comma at the end actively denotes a kind of sequence, a matter
> of python syntax. There won't be an immediate error as "blah," means
> "1-element tuple" as per
> http://docs.python.org/tutorial/datastructures.html#tuples-and-sequences
>
> i.e.
> username = forms.CharField(),
> means
> username = (forms.CharField(),)
>
> So the assignment succeeds without error but django later won't do
> anything especially useful with username during inspection of the form
> definition as it'll look at it and go "nope, this ain't a django
> formfield, just some tuple"
>
>
>
Ah, right.  Thanks for pointing out the explanation.  Doing something to
make Django fail loudly for stuff like this (I recall it tripping up someone
once on a model definition as well) might be worthwhile.  The current
no-error-but-really-confusing-results behavior is not ideal.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to