Greg Ewing wrote:
Steven Bethard wrote:
Because the names are so long and you'd have to import them, I've left
them as private attributes of the module, but if there's really
demand, we could rename them to argparse.StoreTrueAction, etc.
What's wrong with just StoreTrue?
All of this
Greg Ewing wrote:
Xavier Morel wrote:
So you'd have to write add_argument('--plot',
action=actions.store_true) which is straight from the department of
redundant redundancies.
This could easily be fixed with
from argparse.actions import store_true
Converting argparse from a module to a
Nick Coghlan wrote:
Greg Ewing wrote:
Steven Bethard wrote:
Because the names are so long and you'd have to import them, I've left
them as private attributes of the module, but if there's really
demand, we could rename them to argparse.StoreTrueAction, etc.
What's wrong with just StoreTrue?
On Wed, Mar 10, 2010 at 7:46 AM, Nick Coghlan ncogh...@gmail.com wrote:
All of this discussion about the class names is ignoring the main
benefit of using the string names:
Another benefit of strings is that data-driven argparse configuration
will usually be slightly simpler.
Some of us find
On Mon, 08 Mar 2010 15:35:46 -0600, Robert Kern robert.k...@gmail.com wrote:
On 2010-03-08 15:20 PM, Greg Ewing wrote:
Mark Russell wrote:
Boolean flags are a common enough case that I'd be inclined to add a
wrapper method,
parser.add_bool_argument('--plot')
+1, this looks good.
On Tue, Mar 9, 2010 at 11:31, R. David Murray rdmur...@bitdance.com wrote:
On Mon, 08 Mar 2010 15:35:46 -0600, Robert Kern robert.k...@gmail.com wrote:
On 2010-03-08 15:20 PM, Greg Ewing wrote:
Mark Russell wrote:
Boolean flags are a common enough case that I'd be inclined to add a
wrapper
On 7 Mar 2010, at 19:49, Guido van Rossum wrote:
How would you write the example instead then?
Boolean flags are a common enough case that I'd be inclined to add a wrapper
method, so you could just say:
parser.add_bool_argument('--plot')
As you can always fall back to the more general
On Sun, Mar 7, 2010 at 11:49 AM, Guido van Rossum gu...@python.org wrote:
On Sun, Mar 7, 2010 at 4:29 AM, Neal Becker ndbeck...@gmail.com wrote:
Brian Curtin wrote:
On Fri, Mar 5, 2010 at 12:51, Neal Becker ndbeck...@gmail.com wrote:
I generally enjoy argparse, but one thing I find rather
On Mon, Mar 8, 2010 at 7:40 AM, Steven Bethard steven.beth...@gmail.com wrote:
On Sun, Mar 7, 2010 at 11:49 AM, Guido van Rossum gu...@python.org wrote:
On Sun, Mar 7, 2010 at 4:29 AM, Neal Becker ndbeck...@gmail.com wrote:
Brian Curtin wrote:
On Fri, Mar 5, 2010 at 12:51, Neal Becker
On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard
steven.beth...@gmail.com wrote:
In argparse, unlike optparse, actions are actually defined by objects
with a particular API, and the string is just a shorthand for
referring to that. So:
parser.add_argument ('--plot', action='store_true')
is
On Monday 08 March 2010, David Stanek wrote:
On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard
steven.beth...@gmail.com wrote:
In argparse, unlike optparse, actions are actually defined by objects
with a particular API, and the string is just a shorthand for
referring to that. So:
On 8 Mar 2010, at 16:53 , David Stanek wrote:
On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard
steven.beth...@gmail.com wrote:
In argparse, unlike optparse, actions are actually defined by objects
with a particular API, and the string is just a shorthand for
referring to that. So:
On Mon, Mar 8, 2010 at 11:49 AM, Xavier Morel python-...@masklinn.net wrote:
On 8 Mar 2010, at 16:53 , David Stanek wrote:
On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard
steven.beth...@gmail.com wrote:
In argparse, unlike optparse, actions are actually defined by objects
with a particular
Steven Bethard wrote:
On Mon, Mar 8, 2010 at 7:40 AM, Steven Bethard steven.beth...@gmail.com wrote:
On Sun, Mar 7, 2010 at 11:49 AM, Guido van Rossum gu...@python.org wrote:
On Sun, Mar 7, 2010 at 4:29 AM, Neal Becker ndbeck...@gmail.com wrote:
Brian Curtin wrote:
On Fri, Mar 5, 2010 at
On Mon, Mar 8, 2010 at 9:17 AM, Ron Adam r...@ronadam.com wrote:
I like the strings. They are simple and easy to use/read and they don't
have to be created or imported before the parser is defined.
I like them too. I don't see anything unpythonic about them.
That allows me
to put the parser
Mark Russell wrote:
Boolean flags are a common enough case that I'd be inclined to add a wrapper
method,
parser.add_bool_argument('--plot')
+1, this looks good.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
Steven Bethard wrote:
Because the names are so long and you'd have to import them, I've left
them as private attributes of the module, but if there's really
demand, we could rename them to argparse.StoreTrueAction, etc.
What's wrong with just StoreTrue?
--
Greg
On 2010-03-08 15:20 PM, Greg Ewing wrote:
Mark Russell wrote:
Boolean flags are a common enough case that I'd be inclined to add a
wrapper method,
parser.add_bool_argument('--plot')
+1, this looks good.
I've added it to the argparse bugtracker, along with my suggested spelling
add_flag():
Xavier Morel wrote:
So you'd have to write
add_argument('--plot', action=actions.store_true) which is straight from
the department of redundant redundancies.
This could easily be fixed with
from argparse.actions import store_true
An option would be
David Stanek dsta...@dstanek.com writes:
On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard
steven.beth...@gmail.com wrote:
parser.add_argument ('--plot', action='store_true')
[…]
+1.
Any reason not to do something like:
from argparse import actions
...
Am 06.03.2010 03:28, schrieb Antoine Pitrou:
Le Fri, 05 Mar 2010 13:51:15 -0500,
Neal Becker ndbeck...@gmail.com a écrit :
I generally enjoy argparse, but one thing I find rather
ugly and unpythonic.
parser.add_argument ('--plot', action='store_true')
I would argue that a string is
On Sun, Mar 7, 2010 at 4:29 AM, Neal Becker ndbeck...@gmail.com wrote:
Brian Curtin wrote:
On Fri, Mar 5, 2010 at 12:51, Neal Becker ndbeck...@gmail.com wrote:
I generally enjoy argparse, but one thing I find rather
ugly and unpythonic.
parser.add_argument ('--plot',
I don't believe argparse's action specification scheme is bad either, but
On 6 Mar 2010, at 13:50 , Nick Coghlan wrote:
you wouldn't get the static name checking that is
the primary benefit of using named constants in less dynamic languages.
There are quite a few tools which do handle static
Antoine Pitrou wrote:
I would argue that a string is actually more Pythonic than
integers or anonymous objects repurposed as magic constants.
(I'm looking at things such as SEEK_SET and friends)
Strings are certainly preferable to ints, one reason being that
they display as something
On Fri, Mar 5, 2010 at 12:51, Neal Becker ndbeck...@gmail.com wrote:
I generally enjoy argparse, but one thing I find rather
ugly and unpythonic.
parser.add_argument ('--plot', action='store_true')
Specifying the argument 'action' as a string is IMO ugly.
What else would you propose?
On Fri, Mar 5, 2010 at 10:51 AM, Neal Becker ndbeck...@gmail.com wrote:
I generally enjoy argparse, but one thing I find rather
ugly and unpythonic.
parser.add_argument ('--plot', action='store_true')
Specifying the argument 'action' as a string is IMO ugly.
If it really bothers you, you
Le Fri, 05 Mar 2010 13:51:15 -0500,
Neal Becker ndbeck...@gmail.com a écrit :
I generally enjoy argparse, but one thing I find rather
ugly and unpythonic.
parser.add_argument ('--plot', action='store_true')
I would argue that a string is actually more Pythonic than
integers or anonymous
27 matches
Mail list logo