Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'list?': 0.07; 'none:': 0.07; '"if': 0.09; 'lawrence': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'none.': 0.16; 'sentinel': 0.16; 'target_list': 0.16; 'thinking,': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'cc:addr:python.org': 0.22; 'tells': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'team.': 0.31; 'says': 0.33; "can't": 0.35; 'something': 0.35; 'test': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'wrong': 0.37; 'list': 0.37; 'list.': 0.37; 'being': 0.38; 'list,': 0.38; 'pm,': 0.38; 'enough': 0.39; 'either': 0.39; 'catch': 0.60; "you've": 0.63; 'name': 0.63; 'kind': 0.63; 'great': 0.65; 'mar': 0.68; 'captain': 0.91; 'why?': 0.91; 'to:none': 0.92; 'dream': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=c9H9ameaUxxxIPZBIEVmwdlR2eKyfBOGzF68o9tBVYI=; b=tJtHn3AFjWmbW3vzjp4MWQCaDZfD/S4XQMwcsHkYd02mIqNRN0kJIo52xIswQcOOFX X0/RHQAFbzNGTrO+944wWgmi84i2Ode5oMyDsaf8zb0rF1gFr7N9OVr+jBG1MWSDhMBO 6YakCYR8lVTpnhLxXHz8DHOtiArBr9YHmG3uzZv2izvN25+/Jp1J0d7XDCjrptlVnM5C SoroWBkrK4kEiqq3cmOoKH0Q3m7sCF1DgLQnOYgcZt67HNIVdIA51Pwp0FMpU1QR6gBe XxS6VUWpnr9OTWkZIkFEK5RYXvU5VSczs7h/e6c44nMDj0OqvKn8ymo/amUuv5/AY7bK yBFQ== MIME-Version: 1.0 X-Received: by 10.66.27.202 with SMTP id v10mr6472057pag.127.1394023526113; Wed, 05 Mar 2014 04:45:26 -0800 (PST) In-Reply-To: References: <53144e8d$0$2149$426a74cc@news.free.fr> <1d1dfa1b-b715-4d8f-9c12-f0d3dc1a22c9@googlegroups.com> <85ppm3httu.fsf@benfinney.id.au> <20140303155112.46e34ff8@bigbox.christie.dr> <87siqy7whs.fsf@elektro.pacujo.net> <53155c15$0$2923$c3e8da3$76491128@news.astraweb.com> <164d209c-ba5e-449f-bc25-c27ebfb1fc0f@googlegroups.com> <8761ntp3ja.fsf@elektro.pacujo.net> Date: Wed, 5 Mar 2014 23:45:25 +1100 Subject: Re: Reference From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394023528 news.xs4all.nl 2861 [2001:888:2000:d::a6]:60896 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67842 On Wed, Mar 5, 2014 at 11:35 PM, Mark Lawrence 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