question of style

Paul Rubin http
Fri Jul 3 03:27:54 EDT 2009


Lie Ryan <lie.1296 at gmail.com> writes:
> I guess in python, None as the missing datum idiom is still quite prevalent:

Well, sometimes there is no way around it, but:

> def cat_list(a=None, b=None):
>     # poor man's list concatenation
>     if a is None and b is None: return []
>     if a is None: return b
>     if b is None: return a
>     return a + b

def cat_list(a=[], b=[]):
    return a + b



More information about the Python-list mailing list