On Sep 16, 2010, at 6:41 PM, Bruno Rocha wrote:
> In Python the constructor dict() creates a dictionary, so doing
> dict(name='Tom') will create a dictionary and
> is the same as doing
> {'name':'Tom'}
>
The key here, Tom, is that dict() is a function call, and in dict(name="tom"),
we're looking at a named argument (the argument with the name 'name' has the
value 'tom'), not an assignment.
So with return dict(form=form) (not return(form=form), which wouldn't work),
you're returning a Python dictionary (which is what dict() returns) that has a
key named 'form' whose value is form, the object you created in your
controller. The key string happens to be the same as the name of the object,
but that's just a coincidence. Or a convenience.