Thanks guys, that was very clear and helpful.
On Mar 24, 2:23 am, Mahmoud Abdelkader wrote:
> 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
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_
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 d
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 ema
4 matches
Mail list logo