On Tue, 2010-03-23 at 23:14 -0700, Daniel wrote:
> Hi,
> 
> Are these statements equivalent?  I want to say no, but I can't see
> why.

Nope. If the key 'foo' doesn't exist, request.POST.get('foo') will
return None, while request.POST['foo'] will blow up with a KeyError.
Using the get() method on dictionaries also allows you to provide a
default value as the second argument, to be returned instead of None if
the key doesn't exist.

E


> 
> Thank you
> 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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