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


Groups > comp.lang.python > #83444

Re: Why does argparse return None instead of [] if an append action isn't used?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:None': 0.09; 'subject:Why': 0.09; 'cc:addr:python-list': 0.11; 'assigns': 0.16; 'call?': 0.16; 'subject: \n ': 0.16; 'subject:argparse': 0.16; 'cc:addr:python.org': 0.22; 'skip': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'option': 0.32; 'used,': 0.33; 'noticed': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'being': 0.38; 'confirmed': 0.38; 'list,': 0.38; 'rather': 0.38; 'default': 0.69
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=QB4EZPmKs83ho48yMcxgk2rFbwsOeslSz/ame0YxIPE=; b=j+SZXU5nWiarAalesHZA4FS7RSQYngDHdgpryNCcLkg7fJQDqCvesTP3gBfgkYsrtu EfDif83UY+ddMDHwCKRt1+54OwRCaNQszK0a5wzcg85T882zvdw2o1s40CK4ie3DIOkM EPxY9q3+g3aPiYuqnruTzankTReCJ7dJ5612SOriADI21sXs/hhSLjFpbhQDIwCp88vW cg07qHsgS87QpMSNS5RAOLnCcVnEpD81yk8XZl4x7qURQRVnwcNNfARlJME9rnNtVfD3 SWelq8EF532N3uCu0SWCMNCPvILNRNjCb0Wz4fEJq6lBcBjj+MXeLy/3Y4Tncq9LNITW Cv1A==
MIME-Version 1.0
X-Received by 10.60.144.194 with SMTP id so2mr9464481oeb.65.1420815423502; Fri, 09 Jan 2015 06:57:03 -0800 (PST)
In-Reply-To <l265obxc6d.ln2@news.ducksburg.com>
References <l265obxc6d.ln2@news.ducksburg.com>
Date Fri, 9 Jan 2015 08:57:03 -0600
Subject Re: Why does argparse return None instead of [] if an append action isn't used?
From Skip Montanaro <skip.montanaro@gmail.com>
To Adam Funk <a24061@ducksburg.com>
Content-Type text/plain; charset=UTF-8
Cc Python <python-list@python.org>
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.17527.1420815432.18130.python-list@python.org> (permalink)
Lines 8
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420815432 news.xs4all.nl 2853 [2001:888:2000:d::a6]:53226
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83444

Show key headers only | View raw


> I noticed in use that if an option with the 'append' action isn't
> used, argparse assigns None to it rather than an empty list, &
> confirmed this interactively:

I don't use argparse (or optparse), being a getopt Luddite myself, but
can you set the default for an action in the add_argument call?

Skip

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


Thread

Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-09 14:44 +0000
  Re: Why does argparse return None instead of [] if an append action isn't used? Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-09 08:57 -0600
    Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-09 15:25 +0000
  Re: Why does argparse return None instead of [] if an append action isn't used? Ned Batchelder <ned@nedbatchelder.com> - 2015-01-09 10:12 -0500
    Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-26 13:43 +0000
      Re: Why does argparse return None instead of [] if an append action isn't used? Peter Otten <__peter__@web.de> - 2015-01-26 15:04 +0100
        Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-26 15:50 +0000
          Re: Why does argparse return None instead of [] if an append action isn't used? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-26 09:13 -0700
            Re: Why does argparse return None instead of [] if an append action isn't used? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-26 18:29 +0200
              Re: Why does argparse return None instead of [] if an append action isn't used? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-26 17:18 +0000
              Re: Why does argparse return None instead of [] if an append action isn't used? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-26 11:23 -0700
              Re: Why does argparse return None instead of [] if an append action isn't used? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-26 11:26 -0700
  Re: Why does argparse return None instead of [] if an append action isn't used? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2015-01-09 16:50 +0100
    Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-26 13:43 +0000

csiph-web