Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92041 > unrolled thread

Re: Argument Presence Checking via Identity or Boolean Operation?

Started byPeter Otten <__peter__@web.de>
First post2015-06-04 11:28 +0200
Last post2015-06-04 11:28 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Argument Presence Checking via Identity or Boolean Operation? Peter Otten <__peter__@web.de> - 2015-06-04 11:28 +0200

#92041 — Re: Argument Presence Checking via Identity or Boolean Operation?

FromPeter Otten <__peter__@web.de>
Date2015-06-04 11:28 +0200
SubjectRe: Argument Presence Checking via Identity or Boolean Operation?
Message-ID<mailman.154.1433410181.13271.python-list@python.org>
Frank Millman wrote:

> I have a slight variation in that I want to keep a reference to the
> argument -
> 
> def __init__(self, arg=None):
>     self.arg = arg or []
> 
> Based on your comment, I have changed it to -
> 
> def __init__(self, arg=None):
>     self.arg = [] if arg is None else arg
> 
> Does this pass your 'stop and consider' test?

Yes, that avoids the problem of the original code.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web