On 26 Mar, 08:18, Niklas Norrthon <niklas.norrt...@hotmail.com> wrote:

> But that can easily be achieved with the "or" operator as Michiel
> Overton notes elsewhere in this thread:

Michiel Overtoom was what I meant to write. My apologies!

> def some_function(arg, coll=None):
>     do_stuff(arg)
>     for item in coll or []:  # <= Here or is used to make None behave
> as an empty collection
>         do_more(arg, item)
>
> /Niklas Norrthon

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to