Steven Bethard added the comment:
I'm happy to contribute argparse to the standard library and volunteer
to maintain it.
For what it's worth, I don't agree that there are already too many
argument parsing libraries in the standard library. I do agree that
there are already t
Steven Bethard added the comment:
On Tue, Jun 9, 2009 at 11:45 PM, Martin v. Löwis wrote:
> It would be useful if several people could confirm that argparse
> is *not* horribly designed.
A totally reasonable request. Anyone willing to evaluate this can take
a look at:
Steven Bethard added the comment:
Yeah, the % formatting is an artifact of argparse being around before
str.format was available. If argparse became part of the standard
library, it might be reasonable to change to str.format formatting
instead as part of the move.
It would mean that folks
New submission from Steven Bethard :
Right now, bdist_msi can run out of memory when used for larger
packages. (I found this problem working with NLTK.) The solution is
really simple - just add a db.Commit() so that stuff gets flushed to
disk more often. The attached patch does just that.
I set
Steven Bethard added the comment:
Done in r73499 and r73500. Thanks!
--
resolution: accepted -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/
Steven Bethard added the comment:
Given that the one obvious way of using dict-style syntax given a Python object
is to call vars(), I thing adding a __getitem__ is probably a bad idea.
--
___
Python tracker
<http://bugs.python.org/issue8
Steven Bethard added the comment:
That's right, it doesn't support subscripting. The docs are silent on what
namespace is mainly because I don't want to commit to anything other than an
object with attributes. But that could be made clearer in the docs.
--
versio
Changes by Steven Bethard :
--
assignee: -> bethard
nosy: +bethard
___
Python tracker
<http://bugs.python.org/issue9026>
___
___
Python-bugs-list mai
Steven Bethard added the comment:
Yes, please generate patches from the Python repository.
Thanks!
--
___
Python tracker
<http://bugs.python.org/issue9
New submission from Steven Bethard :
[From the old argparse tracker:
http://code.google.com/p/argparse/issues/detail?id=20]
You can't follow a nargs='+' optional argument with a positional argument:
>>> import argparse
>>> parser = argparse.ArgumentParser(pro
Steven Bethard added the comment:
Note that the negative number heuristic you're complaining about doesn't
actually affect your code below. The negative number heuristic is only used
when you have some options that look like negative numbers. See the docs for
more informat
Steven Bethard added the comment:
This is definitely a different bug from the one you just marked it as a
duplicate of.
--
resolution: duplicate ->
stage: committed/rejected -> needs patch
status: closed -> open
superseder: argparse does not accept options taking arguments
New submission from Steven Bethard :
[Moved from http://code.google.com/p/argparse/issues/detail?id=45]
If you try to use parse_known_args and you have a subparser, the subparser will
still complain if it sees extra arguments:
>>> parser = argparse.ArgumentParser()
>&
New submission from Steven Bethard :
[Moved from http://code.google.com/p/argparse/issues/detail?id=53]
It's currently not possible to have subcommands formatted in groups, e.g.
instead of:
subcommands:
{a,b,c,d,e}
a a subcommand help
b b subcommand help
Steven Bethard added the comment:
In argparse, "-debug" is a perfectly valid flag (you're not required to have
"--debug", and you can even have "+debug" if you want and you specify it
correctly), so unless I misunderstand what the bug
Steven Bethard added the comment:
Not sure, but I think _print_message in argparse isn't exactly what the OP is
looking for if they really only care about errors. If you want to override how
errors are printed, then it's absolutely correct to override the error method
(in argpars
New submission from Steven Bethard :
[From http://code.google.com/p/argparse/issues/detail?id=61]
It should be documented clearly that only the arguments present on the parent
parser at the time ArgumentParser is called will be included in the parser.
>>> parent = argparse.Argum
Steven Bethard added the comment:
Ah, thanks for the fix. No it doesn't need to go in 3.1 - argparse is only in
2.7 and 3.2.
--
___
Python tracker
<http://bugs.python.org/i
New submission from Steven Bethard :
[From http://code.google.com/p/argparse/issues/detail?id=63]
What steps will reproduce the problem?
1. PYTHONPATH=. python test/test_argparse.py
2. do the above in an 80x24 terminal window and it passes
3. do the same in an 80 wide emacs shell buffer and you
New submission from Steven Bethard :
What steps will reproduce the problem?
parser = argparse.ArgumentParser()
parser.add_argument('--foo', type=(int, float))
What is the expected output?
ValueError: (, ) is not callable
What do you see instead?
TypeError: not all arguments conver
New submission from Steven Bethard :
What steps will reproduce the problem?
parser = argparse.ArgumentParser()
parser.add_argument('--foo', nargs=2, metavar=('X','Y','Z'))
parser.parse_args(['-h'])
The error dosn't show up until hel
New submission from Steven Bethard :
Argparse supports silencing help for certain options using SUPPRESS.
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', help=argparse.SUPPRESS)
>>> parser.print_help()
usage: [-h]
optional arguments:
New submission from Steven Bethard :
[From http://code.google.com/p/argparse/issues/detail?id=71]
There is a method ArgumentParser.add_argument_group() to create and add an
argument group to the parser. I would like the ability to remove an argument
group via a method like
New submission from Steven Bethard :
If you use set_defaults on a subparser, but a default exists on the top level
parser, the subparser defaults are ignored:
>>> parser = argparse.ArgumentParser()
>>> xparser = parser.add_subparsers().add_parser('X')
&
New submission from Steven Bethard :
[Moved from http://code.google.com/p/argparse/issues/detail?id=73]
What steps will reproduce the problem?
parser = ArgumentParser(prefix_chars="-+")
parser.add_argument("-a",action="store_true")
parser.add_ar
New submission from Steven Bethard :
[Moved from http://code.google.com/p/argparse/issues/detail?id=75]
What steps will reproduce the problem?
1. import argparse
2. print dir(argparse)
3. print argparse.__all__
Compare the output for public methods and attributes from #2 that aren't in #
New submission from Steven Bethard :
[Moved from http://code.google.com/p/argparse/issues/detail?id=78]
What steps will reproduce the problem?
1. Create two mutually exclusive groups: eg
agroup = subcmd_parser.add_mutually_exclusive_group()
agroup.add_argument('--a1', action='st
Steven Alderson added the comment:
Hello, I've taken the liberty of updating the two patch files here for
python3.2 at revision 83065. Apologies if I'm treading on anyones toes here.
I'm taking part in a europython sprint and this is the first time I've tried
this
Steven Alderson added the comment:
Here's the patch for multiprocessing based on python 3 revision 83065, all
credit to the original author, all problems probably mine!
Steven
--
Added file: http://bugs.python.org/file18153/multiprocessing3k
Steven Bethard added the comment:
I still disagree. You're giving the parser ambiguous input. If a parser sees
"--foo --bar", and "--foo" is a valid option, but "--bar" is not, this is a
legitimately ambiguous situation. Either the user really wanted "
Steven Bethard added the comment:
It *would* be a backwards incompatible change. Currently, if I have a parser
with both a "--foo" and a "--bar" option, and my user types "--foo --bar", they
get an error saying that they were missing the argument to "--foo
Steven Bethard added the comment:
Should this print to stdout or stderr? I wonder if the API should allow either,
and instead look like:
parser.add_argument('--license', action='write', message='...', file=sys.stdout)
Where sys.stdout would be the default for
Steven Bethard added the comment:
The equivalent to optparse callback is basically to define __call__ in a
subclass of Action. Pretty much the same amount of work because they both have
complicated parameters.
The "callable" I (not fully confidently) proposed would just be a sho
Steven Bethard added the comment:
Yes, this looks fine, assuming a test is also added.
--
___
Python tracker
<http://bugs.python.org/issue9444>
___
___
Python-bug
Steven Bethard added the comment:
The patch looks basically right. A few minor issues:
* "message=None," should probably be "message,", that is, message should not be
allowed to default to None - I can't see any use case for this action without a
message. I belie
Steven Bethard added the comment:
It is intentional that you have to specify both "/foo" and "+foo" if you want
them to be aliases for the same argument. A common use case for prefix_chars is
to define "+x" and "-x" options, which usually mean different
Steven Bethard added the comment:
A doc patch would also be welcome, but I do think it's a bug that
"ArgumentParser(prefix_chars='+')" throws an exception, and I think Ted's patch
looks fine to me.
--
___
Python tr
Steven Bethard added the comment:
Yep, I'm fine with you committing this (after adding the prefix="+-/" you
suggested). I don't have time right now to test the patches, but the code looks
about right, and the tests ran fine for you,
Steven Bethard added the comment:
You can specify either 1 or N. So for n=3, you can specify metavar="X" or
metavar=("X", "Y", "Z") but not metavar=("X", "Y"). The special nargs value "?"
always takes only one, while
Steven Bethard added the comment:
Unassigning, because it's likely I won't have time to work on this for a while.
I still think it would be a nice feature. ;-)
--
assignee: bethard ->
___
Python tracker
<http://bugs.pyth
Steven Bethard added the comment:
Seems like there's minimally the bug that argparse should currently throw an
error if you add an argument after subparsers (since that argument will never
be parsed under the current semantics).
I do believe that supporting an optional command like the
Steven Bethard added the comment:
These all look like good changes to me. (I looked at the patch, but haven't
tried applying it though.)
--
___
Python tracker
<http://bugs.python.org/i
Steven Bethard added the comment:
Marking as duplicate of 9553 (which has a better description and a patch).
--
resolution: -> duplicate
___
Python tracker
<http://bugs.python.org/iss
Steven Bethard added the comment:
The best solution would be to make sure that a few different column widths are
tested. However, in the meantime, the tests do assume 80 columns, so I think
it's correct to specify that using os.environ as suggested.
One problem with the proposed pat
Steven Bethard added the comment:
Actually closing this time. Duplicate of issue 9553.
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/iss
Steven Bethard added the comment:
Duplicate of issue 9026.
--
resolution: -> duplicate
status: open -> closed
superseder: -> argparse subcommands not printed in the same order they were
added
___
Python tracker
<http://bugs.python.o
Steven D'Aprano added the comment:
I had a brief look at the source for ABCMeta, and it seems to me that the
__module__ behaviour is coming from `type`. I'm not sure whether it can, or
should, can be fixed in type, but I think that the correct behaviour for
ABCMeta is to set __modul
Steven D'Aprano added the comment:
Hi John, and thanks for the bug report. If only they were all as easily
resolved as this one :-)
With respect, if you're just getting started with Python, you shouldn't get
into the habit of hitting the bug tracker every time you find
New submission from steven Michalske:
The slicing and using inputed math is is necessary to provide a special case to
make the code behave as expected.
Unless I'm missing something. Like we can't do this, as we loose negative
indexing from the end of the file?
Let's tak
steven Michalske added the comment:
Argh, I swear I proofread this...
print([a[x] for x in [slice(y+3, y-1, -1) for y in range(0, len(a), 4)]])
[[], [7, 7, 6, 5]]
Catching my explicit case, I changed my code to:
print([a[x] for x in [slice(y+3, y-1 if y > 1 else None, -1) for y in rang
Steven D'Aprano added the comment:
On Tue, Dec 13, 2016 at 09:35:22AM +, Srikanth Anantharam wrote:
>
> Srikanth Anantharam added the comment:
>
> A better choice would be to return a tuple of values (sliced from the
> table). And let the user decide which one to us
Steven D'Aprano added the comment:
I independently raised this on Python-Ideas and the initial responses are that
vars() should support objects with slots too.
https://mail.python.org/pipermail/python-ideas/2016-December/043965.html
--
nosy: +steven.daprano
versions: +Pytho
Steven D'Aprano added the comment:
On Tue, Dec 13, 2016 at 10:08:10AM +, Srikanth Anantharam wrote:
> Please see the updated pull request PR 50, with the changes.
I'm rejecting that pull request. As I said, mode() intentionally
returns only the single, unique mode. I m
Steven D'Aprano added the comment:
On Tue, Dec 13, 2016 at 10:17:21AM +, Srikanth Anantharam wrote:
>
> Srikanth Anantharam added the comment:
>
> @steven:
>
> data = [1, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9]
> is clearly unimodal with mode 8
Steven D'Aprano added the comment:
You haven't given any reason to explain why you think the existing docs are
wrong, nor any reason why you think your version is better. Just stating that
the docs give "misinformation" is not good enough.
By your matrix, 'Python
Steven D'Aprano added the comment:
> _randbelow is a private api and it is not broken, it is just being
> misused by the secrets module.
"Misused" seems a bit strong. Should I understand that you dislike the
wrapper around _randbelow? The implementation was given in
New submission from Steven D'Aprano:
argparse help incorrectly breaks long lines on U+u00A0 NO-BREAK SPACE.
The attached script has been run on Python 3.5.3rc1 in a terminal window 80
columns wide, and it produces output::
usage: argparse_nobreak.py [-h] [--no-condensed]
opt
Changes by Steven D'Aprano :
Removed file: http://bugs.python.org/file46310/argparse_nobreak.py
___
Python tracker
<http://bugs.python.org/issue29290>
___
___
Pytho
Steven D'Aprano added the comment:
Here's a slightly simpler demo, without the (fortunately harmless) typo.
--
Added file: http://bugs.python.org/file46311/argparse_nobreak.py
___
Python tracker
<http://bugs.python.o
Steven D'Aprano added the comment:
On Sun, Jan 29, 2017 at 08:23:05AM +, Martin Panter wrote:
> Why do you name the methods is_finite() etc with underscores, when the
> existing methods math.isfinite() etc do not have underscores? Seems it
> would add unnecessary confusion.
Steven D'Aprano added the comment:
re.match only matches at the start of the string. If you use re.search instead,
you will get the results you are expecting.
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: ope
Steven D'Aprano added the comment:
Serhiy, that doesn't generalise to code like:
any(a, b, c, *extras)
which is hard to write out by hand. You would have to say
bool(a or b or c or any(extras))
I think this might be worth considering on Python-Ideas. It will probably be
Steven D'Aprano added the comment:
> Do you think I should send a mail to the ideas list?
Personally, I don't think so. You want to write any(a, b, c, d),
but you can get the same effect now by writing any([a, b, c, d]).
There is unlikely to be any significant performan
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue12741>
___
___
Python-bugs-list mailing list
Unsubscr
Changes by Steven D'Aprano :
--
versions: +Python 3.7 -Python 3.3
___
Python tracker
<http://bugs.python.org/issue12741>
___
___
Python-bugs-list m
Steven D'Aprano added the comment:
What about "administrative data structures" that should be copied?
I think that "administrative data structures" is a red herring: there could be
data that needs copying, and data that needs sharing and shouldn't be copied,
i
Steven D'Aprano added the comment:
Only 3.7 can receive new functionality.
Here is a pure Python implementation of a subsequence test:
https://code.activestate.com/recipes/577850-search-sequences-for-sub-sequence/
It appears to be reasonably popular on Activestate: it has about 7000
Steven D'Aprano added the comment:
I agree with Josh: the exception you are giving doesn't seem possible with the
code snippet shown. Please COPY AND PASTE (not a screen shot) the text of the
entire traceback, starting with the line "Traceback..."
I suspect that you m
Steven D'Aprano added the comment:
Terry, I'm not sure if you've read this enhancement request correctly or not,
because your reply when closing covers over a lot of detail which is not
relevant to this feature request.
> Extending this idea to 'subsequence in sequenc
Steven D'Aprano added the comment:
Confirmed that in Python 2.7 calling g() before and after modifying the dict
prints 3 both times; calling g() before modifying the dict prints 3, then after
modifying it prints 5.
Python 3.3 behaves like 2.7, so this sounds like a regression in 3.5 or
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue29602>
___
___
Python-bugs-list mailing list
Unsubscr
Steven Rumbalski added the comment:
Truncated sentence was always truncated.
Introduced on commit bebf73511a1250fc768bcb7192b5b3c3fd04d8f2
from Issue #20287: Argument Clinic's output is now configurable, allowing
delaying its output or even redirecting it to a separate file.
https://githu
Steven D'Aprano added the comment:
I am unable to replicate this in Python 2.7, 3.3 or 3.6. I haven't bothered to
test against other versions, because I think that this is a PyShell issue, not
a Python issue. (I think you are using PyShell, based on the traceback given.)
Before repo
Steven D'Aprano added the comment:
On Mon, May 30, 2016 at 01:43:22AM +, ppperry wrote:
> steven.daprano, you don't appear to have properly read the issue
> comments.
Ack; I saw your comment about the metaclass, then saw your retraction
of the metaclass issue, then mis
Steven D'Aprano added the comment:
Yes. What does such an assertion actually mean?
Why would I write `self.assertNotRaises(ValueError, spam, arg)` rather than
just call `spam(arg)`? The only difference is that assertNotRaises will treat
one specific exception as a test failure rather t
Steven D'Aprano added the comment:
On Thu, Jun 02, 2016 at 09:04:54PM +, Raymond Hettinger wrote:
> Steven, this seems like a reasonable suggestion (though I would expect
> someone else will immediately suggest a harmonic mean as well). Is
> this within the scope of what y
Steven D'Aprano added the comment:
"file://a" is a valid relative file path, for a directory called "file:" and a
file called "a", so normpath should return "file:/a".
--
nosy: +steven.daprano
___
Pytho
Steven D'Aprano added the comment:
Yes, it is intended. Commas create tuples, not parentheses. (With the exception
of the empty tuple.) The parens are just for grouping and precedence. `1,` is a
tuple, regardless of whether you use parens around it or not.
--
nosy: +steven.da
Steven D'Aprano added the comment:
On Thu, Jun 09, 2016 at 09:24:04AM +, Mark Dickinson wrote:
> On the other hand, apparently `exp(mean(log(...)))` is good enough for SciPy:
Hmm, well, I don't have SciPy installed, but I've found that despite
their (well-deserved) repu
Steven D'Aprano added the comment:
I don't want to start another huge thread on python-dev unless really
necessary. What should happen to random.SystemRandom?
(1) nothing, it stays as it is, and if ``secrets`` needs better, it can
subclass it;
(2) it changes to use ``os.getrandom``
New submission from Steven D'Aprano:
Write some documentation for the ``secrets`` module summarizing the issues
relating to /dev/[u]random, getrandom, etc. There's a lot of confusion about
these issues, and the web contains a lot of misinformation, so being able to
point to the se
Steven D'Aprano added the comment:
Relevant: issue #27293
(I've taken the liberty of subscribing those on this issues nosy list to the
new issue, I hope that's okay)
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.pyt
Steven Barker added the comment:
I've just encountered this error when trying to update to the 3.5.2rc1 release
(64-bit Python, Windows 10). I'd already had the 3.5.1 release installed, so I
suppose it could have been an issue with the older installer trying to
uninstall the old v
Changes by Steven Barker :
Added file: http://bugs.python.org/file43371/Python 3.5.2rc1
(64-bit)_20160613002950.log
___
Python tracker
<http://bugs.python.org/issue26
Changes by Steven Barker :
Added file: http://bugs.python.org/file43372/Python 3.5.2rc1
(64-bit)_20160613002148_008_launcher_AllUsers.log
___
Python tracker
<http://bugs.python.org/issue26
Steven D'Aprano added the comment:
Thanks Julio,
I hope to get to this over the next week. Please feel free to prod me if
you see no action by then.
--
___
Python tracker
<http://bugs.python.org/is
New submission from Steven D'Aprano:
The docs for locals() warn not to write to the dict returned, as it may not
have the intended effect of modifying the actual variables seen by the
interpreter.
https://docs.python.org/3/library/functions.html#locals
But as I understanding it, using l
New submission from Steven D'Aprano:
For Issue27181 (add geometric mean to statistics module), I need a function to
calculate nth roots that is more accurate than pow(x, 1/n). E.g. math.pow(1000,
1/3) returns 9.998 instead of 10.0.
I have a pure-Python implementation of
Steven D'Aprano added the comment:
I suggested on python-ideas that the math module be given a pure-Python front
end. Guido wasn't too keen on that idea, so I won't push for it.
He did agree that having nroot in math was a reasonable idea. If I attach a
pure Python implement
Steven D'Aprano added the comment:
For starters, dunder names like __json__ are reserved for Python's own use, so
you would have to get the core developers to officially bless this use.
But... I'm not really sure that "the responsibility of determining how an
object shou
Steven D'Aprano added the comment:
On Mon, Jun 20, 2016 at 09:02:09PM +, Tim Peters wrote:
> Note that the very popular TI graphics calculators have had a distinct
> nth-root function at least since the TI-83. It's a minor convenience
> there.
Likewise HP calculato
New submission from Steven Barker:
When a method is called with incorrect arguments (too many or too few, for
instance), a TypeError is raised. The message in the TypeError generally of the
form:
foo() takes 2 positional arguments but 3 were given
I think the message should include the
Steven D'Aprano added the comment:
On Sat, Jul 02, 2016 at 11:40:48AM +, Utkan Gezer wrote:
>
> New submission from Utkan Gezer:
>
> An issue of enhancement by the introduction of a built-in product()
> function for the multiplication operation, functions similar to
Steven D'Aprano added the comment:
I know this issue is closed, but for future reference, ShubhamSingh.er, if you
submit any further bug reports, please don't submit screen shots unless
necessary. Just copy and paste the text from your terminal into the issue
tracker. A screen sh
Steven D'Aprano added the comment:
Hi Zhihan Chen, I see this issue is closed, but for future reference please
don't post screenshots to report issues unless they are really needed. For text
output, just copy the text from your terminal and paste it into your bug
report. Making a s
Steven D'Aprano added the comment:
I haven't studied your code in detail (I won't be qualified to judge it) but I
notice this comment:
/* Hit the faster unicode_concatenate method if and only if
all the following conditions are true:
1. The left operand is a unic
Steven D'Aprano added the comment:
The behaviour of both are correct: the binary float nearest to 4.4 is just a
smidgen *bigger* than the exact decimal 4.4, so 44//4.4 truncates to 9.0. But
floor(44/4.4) evaluates 44/4.4 first, and that rounds rather than truncating,
giving 10.0, which
Steven D'Aprano added the comment:
Does anyone have any strong feeling about the name for these functions?
gmean and hmean;
geometric_mean and harmonic_mean
And "subcontrary_mean" is not an option :-)
--
___
Python tracker
<http
Steven D'Aprano added the comment:
Raymond, that was a fantastic explanation. Would you be willing to turn it into
a FAQ? Or if you don't have the time, to allow somebody to steal your
description and use it?
--
nosy: +steven.daprano
New submission from Steven D'Aprano:
Way too often I've lost track of whether I'm in the code.interact() REPL or the
original REPL, or hit Ctrl-D once too often, and accidentally quit the real
REPL. It is easy to lose track, since the real and imitation REPL both use the
sa
1601 - 1700 of 1942 matches
Mail list logo