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


Groups > comp.lang.python > #82302

Re: How to detect that a function argument is the default one

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Jussi Piitulainen <jpiitula@ling.helsinki.fi>
Newsgroups comp.lang.python
Subject Re: How to detect that a function argument is the default one
Date 10 Dec 2014 19:20:20 +0200
Organization A noiseless patient Spider
Lines 18
Sender jpiitula@ruuvi.it.helsinki.fi
Message-ID <qotmw6vxvzf.fsf@ruuvi.it.helsinki.fi> (permalink)
References <mailman.16813.1418227811.18130.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx02.eternal-september.org; posting-host="da42b2e96e23bc971f06525f495b78b4"; logging-data="1042"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IUYQwW96q8/JSmNZ9OJIkEp10jvNbfno="
User-Agent Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Cancel-Lock sha1:LJQ3gXRiG58JCAZ2uAiw48Fq5q0=
Xref csiph.com comp.lang.python:82302

Show key headers only | View raw


Jean-Michel Pichavant writes:

> If you like one-liners,
> 
> def __init__(self, center=(0,0), radius=10, mass=None):
>     self.center = center
>     self.radius = radius
>     self.mass = (mass is None and radius**2) or mass

That's not a one-liner. That's a one-liner:

def __init__(self, center=(0,0), radius=10, mass=None): self.center = center ; self.radius = radius ; self.mass = (mass is None and radius**2) or mass

And as others point out, you could highlight the number of
sub-expressions better by using an actual three-place expression.
(Why _that_ is considered so salient, I don't know. But it is.)

</deadpan>

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: How to detect that a function argument is the default one Jean-Michel Pichavant <jeanmichel@sequans.com> - 2014-12-10 17:10 +0100
  Re: How to detect that a function argument is the default one Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-12-10 19:20 +0200

csiph-web