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


Groups > comp.lang.python > #92826

Re: Documenting a function signature (was: Set a flag on the function or a global?)

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'defaults': 0.05; 'default.': 0.07; 'imply': 0.07; '"if': 0.09; 'received:internal': 0.09; 'wed,': 0.15; 'explicitly': 0.15; '(either': 0.16; 'downside': 0.16; 'ellipsis': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'parameter,': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'sentinel': 0.16; 'subject: \n ': 0.16; 'subject:?)': 0.16; 'wrote:': 0.16; 'runs': 0.18; 'provided,': 0.22; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'parameters': 0.27; 'objects': 0.29; 'code': 0.31; 'to:addr :python-list': 0.35; "isn't": 0.35; 'received:10': 0.37; 'subject:: ': 0.37; 'signature': 0.37; 'received:66': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'subject: (': 0.40; 'subject:the': 0.40; 'behavior': 0.61; 'from:no real name:2**0': 0.61; 'providing': 0.61; 'show': 0.62; 'header:Message-Id:1': 0.62; 'risk': 0.67; 'unusual': 0.72; 'aiui': 0.84; 'subject:Set': 0.91
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=cXJ1a/eWDLhz7oH3KD74jrMhYxk=; b=iCbPwA BEyL8CS4msA+Wehgiav0hrHMoK5ahqEj19QvuN5KuTn7XdvoZHdpHI7tXVk1B2av +BrI3vLGGHrs1+4OPluB9ud98Rf7aL5WT0nKQnX4EYb6xamNC59hTAJtZtVkXkqN HddDdpOPLFeQrqNCj5xhQrrRt18cxryxv9els=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=cXJ1a/eWDLhz7oH 3KD74jrMhYxk=; b=Jn+d+ymrnkM3QRlIopMca5DGqEt2AEwZ4vSX2WLLUh09cBy Vkn8Fn9Dpe++MgG3hgNQl+Xc69bNZzPb+g5v3D9gLUIgaFLwL79cLqmO+Ef5Wk8Q KeGvLbVicMTfd7tac53aZna+FujquYeKCx8X6eKt2t9PH+fNg+/RVOdOMaWQ=
X-Sasl-Enc a09WlnWaCkffRqTsdXIg2WLaRAM3c9+7o1GjhP1HLqJb 1434631032
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-32536285
Subject Re: Documenting a function signature (was: Set a flag on the function or a global?)
Date Thu, 18 Jun 2015 08:37:12 -0400
In-Reply-To <CAPTjJmpPh=onWt=WE1pf2eym9jSnNRxxGx-3Aq_22ye+VQ9A7g@mail.gmail.com>
References <557fdbd6$0$11097$c3e8da3@news.astraweb.com> <mailman.530.1434500492.13271.python-list@python.org> <55818b3c$0$1665$c3e8da3$5496439d@news.astraweb.com> <mailman.556.1434553624.13271.python-list@python.org> <55819878$0$1658$c3e8da3$5496439d@news.astraweb.com> <85egl9ubj5.fsf_-_@benfinney.id.au> <CAPTjJmpPh=onWt=WE1pf2eym9jSnNRxxGx-3Aq_22ye+VQ9A7g@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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.598.1434631036.13271.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1434631036 news.xs4all.nl 2939 [2001:888:2000:d::a6]:56646
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92826

Show key headers only | View raw


On Wed, Jun 17, 2015, at 20:14, Chris Angelico wrote:
> Mostly. That would imply that object is a mandatory parameter, which
> AIUI isn't the case for Steven's edir. The downside of this kind of
> signature is that it's hard to show the parameters that have unusual
> defaults (either sentinel objects and custom code to cope, or they're
> pulled out of *a or **kw).

My instinct would be to put =... for that case and explain in the
documentation "If foo is not provided, [behavior]".

Of course, that runs the risk of people thinking you actually mean
Ellipsis, or that providing Ellipsis explicitly will give the same
behavior as the default.

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


Thread

Set a flag on the function or a global? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-15 23:57 +0000
  Re: Set a flag on the function or a global? Chris Angelico <rosuav@gmail.com> - 2015-06-16 10:07 +1000
  Re: Set a flag on the function or a global? Ethan Furman <ethan@stoneleaf.us> - 2015-06-15 17:19 -0700
  Re: Set a flag on the function or a global? Ben Finney <ben+python@benfinney.id.au> - 2015-06-16 10:20 +1000
    Re: Set a flag on the function or a global? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-16 19:07 +1000
  Re: Set a flag on the function or a global? Ethan Furman <ethan@stoneleaf.us> - 2015-06-15 17:21 -0700
  Re: Set a flag on the function or a global? sohcahtoa82@gmail.com - 2015-06-15 17:24 -0700
    Re: Set a flag on the function or a global? MRAB <python@mrabarnett.plus.com> - 2015-06-16 01:35 +0100
      Re: Set a flag on the function or a global? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-16 18:18 +1000
        Re: Set a flag on the function or a global? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-06-16 13:45 +0100
          Re: Set a flag on the function or a global? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-16 22:46 +0000
        Re: Set a flag on the function or a global? Cameron Simpson <cs@zip.com.au> - 2015-06-17 09:51 +1000
          Re: Set a flag on the function or a global? Steven D'Aprano <steve@pearwood.info> - 2015-06-18 00:59 +1000
            Re: Set a flag on the function or a global? Laura Creighton <lac@openend.se> - 2015-06-17 17:06 +0200
              Re: Set a flag on the function or a global? Steven D'Aprano <steve@pearwood.info> - 2015-06-18 01:55 +1000
                Documenting a function signature (was: Set a flag on the function or a global?) Ben Finney <ben+python@benfinney.id.au> - 2015-06-18 10:04 +1000
                Re: Documenting a function signature (was: Set a flag on the function or a global?) Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-17 18:10 -0600
                Re: Documenting a function signature (was: Set a flag on the function or a global?) Chris Angelico <rosuav@gmail.com> - 2015-06-18 10:14 +1000
                Re: Documenting a function signature (was: Set a flag on the function or a global?) random832@fastmail.us - 2015-06-18 08:37 -0400
                Re: Documenting a function signature (was: Set a flag on the function or a global?) Laura Creighton <lac@openend.se> - 2015-06-18 23:38 +0200
                Re: Documenting a function signature Ben Finney <ben+python@benfinney.id.au> - 2015-06-19 10:41 +1000
  Re: Set a flag on the function or a global? Ron Adam <ron3200@gmail.com> - 2015-06-15 20:24 -0400
    Re: Set a flag on the function or a global? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-16 19:15 +1000
      Re: Set a flag on the function or a global? Ron Adam <ron3200@gmail.com> - 2015-06-16 07:02 -0400
  Re: Set a flag on the function or a global? Chris Angelico <rosuav@gmail.com> - 2015-06-16 10:32 +1000
  Re: Set a flag on the function or a global? Paul Rubin <no.email@nospam.invalid> - 2015-06-15 17:37 -0700
    Re: Set a flag on the function or a global? Ethan Furman <ethan@stoneleaf.us> - 2015-06-15 17:53 -0700
      Re: Set a flag on the function or a global? Paul Rubin <no.email@nospam.invalid> - 2015-06-15 19:04 -0700
    Re: Set a flag on the function or a global? MRAB <python@mrabarnett.plus.com> - 2015-06-16 02:15 +0100
    Re: Set a flag on the function or a global? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-16 18:30 +1000
  Re: Set a flag on the function or a global? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-16 07:06 +0100
    Re: Set a flag on the function or a global? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-16 19:28 +1000
  Re: Set a flag on the function or a global? Jonas Wielicki <jonas@wielicki.name> - 2015-06-16 12:00 +0200
  Re: Set a flag on the function or a global? Michael Torrie <torriem@gmail.com> - 2015-06-16 07:44 -0600
  Re: Set a flag on the function or a global? Michael Torrie <torriem@gmail.com> - 2015-06-16 07:56 -0600
  Re: Set a flag on the function or a global? Peter Otten <__peter__@web.de> - 2015-06-16 15:59 +0200
  Re: Set a flag on the function or a global? Ethan Furman <ethan@stoneleaf.us> - 2015-06-16 07:57 -0700

csiph-web