On Wed, Mar 5, 2014 at 11:35 PM, Mark Lawrence <breamore...@yahoo.co.uk> wrote: >> if the_list is None: >> >> >> Marko >> > > Really great thinking, test the name the_list, which strangely enough tells > me that this beast is a list, in the same way that THIS_IS_A_CONSTANT is a > constant, to see if it's None. Congratulations, you've been promoted to > captain of my dream team.
Uhh... why? What's wrong with something either being a list or being None to indicate no list? def foo(x, target_list=None): if target_list is not None: target_list = default_targets You can't use "if target_list:" here, because that would also catch an empty list. You need some kind of sentinel that says "there isn't a list here". ChrisA -- https://mail.python.org/mailman/listinfo/python-list