Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92041
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: Argument Presence Checking via Identity or Boolean Operation? |
| Date | 2015-06-04 11:28 +0200 |
| Organization | None |
| References | <CAAKgPaGY_4yB7z=R-UO=s5TEWwEXZsE1nSEXw00sQPMfH_Xt2g@mail.gmail.com> <mkp10p$n0l$1@ger.gmane.org> <mkp2ie$glr$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.154.1433410181.13271.python-list@python.org> (permalink) |
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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Argument Presence Checking via Identity or Boolean Operation? Peter Otten <__peter__@web.de> - 2015-06-04 11:28 +0200
csiph-web