+1 on a method that returns non upon not finding. We don't need to do: try: val = some_dict.get('key') except KeyError: val = None
either. A nget or get_or_none would save me a lot of boilerplate code in my views as well. Tino On Tue, Oct 9, 2012 at 8:48 PM, Wim Feijen <wimfei...@gmail.com> wrote: > For me, get_or_none would prevent a lot of boilerplate code in my views, > so I am in favor of adding the method. > > Wim > > Op dinsdag 9 oktober 2012 19:15:55 UTC+2 schreef ptone het volgende: > >> Unsurprisingly - this has come up before: >> >> Earlier discussion >> https://groups.google.com/**forum/?fromgroups=#!topic/** >> django-developers/Saa5nbzqQ2Q<https://groups.google.com/forum/?fromgroups=#!topic/django-developers/Saa5nbzqQ2Q> >> >> tickets: >> https://code.djangoproject.**com/ticket/17546<https://code.djangoproject.com/ticket/17546> >> https://code.djangoproject.**com/ticket/2659<https://code.djangoproject.com/ticket/2659> >> https://code.djangoproject.**com/ticket/11352<https://code.djangoproject.com/ticket/11352> >> >> All the ticket's were wontfixed >> > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-developers/-/_nHUoZZICcQJ. > > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.