Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17937
| Date | 2011-12-25 19:14 -0600 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: How safe is this way of getting a default that allows None? |
| References | <CAGGBd_rJX1ZOS31mn7SNfkugeMMe5kZpHFA_aVQyCnTPuRdWhg@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4087.1324862079.27778.python-list@python.org> (permalink) |
On 12/25/11 18:49, Dan Stromberg wrote: > How safe is this? I like the idea. > > UNSPECIFIED = object() > > def fn(x, y=UNSPECIFIED): > if y is UNSPECIFIED: > print x, 'default' > else: > print x, y safe? It's idiomatic :) -tkc
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How safe is this way of getting a default that allows None? Tim Chase <python.list@tim.thechases.com> - 2011-12-25 19:14 -0600
csiph-web