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


Groups > comp.lang.python > #82295

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'subject:How': 0.10; 'def': 0.12; 'none.': 0.16; 'subject:default': 0.16; 'ternary': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'instead.': 0.24; '&gt;': 0.26; 'gets': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; 'subject:that': 0.31; 'actual': 0.34; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'mass': 0.36; 'subject:one': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=R2ILrzbZKH11wccnt075Iz9UC1fFKNT1AflvZw81ZeQ=; b=Fg/NmJDY0mNs07+/WveBrg1d/C4rQJV9mUWI3zAtGryW/tKYI9eDJg9bwP4KbgB+QI f8Tiz2zj/2vI3thgVFKmsHGDfr5dDduykom1PFBHB1pn3A5VlYRcQC3hoGySn04vI1fP L0AGZ0LsksHBbBBwQKul6RcHgUniOTcCl7wIunqc342u7jJwxNw/4FxYgSxe1GWCg9sj AuUYlJf3Ln7kNJP561myaXyphA6mdqBig0MHyPzld7i/WT3UywVIpqidha4L+VhWbie6 c6dvGXV1ELQeHn98XM4bHAJ0PLpfjv7UXenpI7mDDR29g5OF1Ddgy4z7GNzDlwTOjyWU 3WnA==
X-Received by 10.66.220.34 with SMTP id pt2mr8487047pac.142.1418228488991; Wed, 10 Dec 2014 08:21:28 -0800 (PST)
MIME-Version 1.0
In-Reply-To <1967177562.5434671.1418227803051.JavaMail.root@sequans.com>
References <5488634e$0$2130$426a74cc@news.free.fr> <1967177562.5434671.1418227803051.JavaMail.root@sequans.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 10 Dec 2014 09:20:48 -0700
Subject Re: How to detect that a function argument is the default one
To Python <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7b5da4f34bfa7e0509df0d32
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16816.1418228498.18130.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418228498 news.xs4all.nl 2902 [2001:888:2000:d::a6]:56456
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82295

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Dec 10, 2014 at 9:10 AM, Jean-Michel Pichavant <
jeanmichel@sequans.com> wrote:
> 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

If mass is None and radius is 0, then self.mass gets set to None. Use the
actual ternary operator instead.

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


Thread

How to detect that a function argument is the default one "ast" <nomail@invalid.com> - 2014-12-10 16:14 +0100
  Re: How to detect that a function argument is the default one Skip Montanaro <skip.montanaro@gmail.com> - 2014-12-10 09:29 -0600
    Re: How to detect that a function argument is the default one "ast" <nomail@invalid.com> - 2014-12-10 16:45 +0100
    Re: How to detect that a function argument is the default one Marko Rauhamaa <marko@pacujo.net> - 2014-12-10 18:33 +0200
  Re: How to detect that a function argument is the default one Chris Angelico <rosuav@gmail.com> - 2014-12-11 03:16 +1100
    Re: How to detect that a function argument is the default one wxjmfauth@gmail.com - 2014-12-10 12:08 -0800
    Re: How to detect that a function argument is the default one "ast" <nomail@invalid.com> - 2014-12-10 22:17 +0100
      Re: How to detect that a function argument is the default one Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-11 11:03 -0700
      Re: How to detect that a function argument is the default one Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-11 11:07 -0700
  Re: How to detect that a function argument is the default one Ned Batchelder <ned@nedbatchelder.com> - 2014-12-10 11:19 -0500
  Re: How to detect that a function argument is the default one Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-10 09:20 -0700
  Re: How to detect that a function argument is the default one Tony the Tiger <tony@tiger.invalid> - 2014-12-11 19:45 +0000
    Re: How to detect that a function argument is the default one Ben Finney <ben+python@benfinney.id.au> - 2014-12-12 10:03 +1100

csiph-web