In python, dictionaries have a get method that will return None if you
call it on a dictionary key that doesn't exist. get() can also take an
optional default parameter that returns it's value if the key doesn't
exist.

If you use the indexing method, i.e. [], it invokes the dictionaries
__getitem__ method, which can throw a KeyError exception if the key
doesn't exist.



--Sent from my iPhone

On Mar 23, 2010, at 11:14 PM, Daniel <unagimiy...@gmail.com> wrote:

> Hi,
>
> Are these statements equivalent?  I want to say no, but I can't see
> why.
>
> 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
> .
>

-- 
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