Yeah, I have been hearing that people are having troubles converting, but I
have only used argparse - got lucky there I guess.
I am thinking just making the function which spits the class out. Maybe not
very optimised solution, but simple.
Argument parsing in my case is very far from being a
27;ve worked more with optparse (the project I work on that uses it has
reasons why it's not feasible to convert to argparse); in optparse you
use a callback function, rather than an action class, and the change to
a callable class is somewhat significant :-; so I'm not really an expert.
h3') and convert it to the desired output - list:
>> import argparse
>> parser = argparse.ArgumentParser()
>> parser.add_argument('paths', type=lambda x: list(filter(str.strip,
>> x.split(','
>> So far so good. But this is just an examp
On 11/27/23 04:29, Dom Grigonis via Python-list wrote:
Hi all,
I have a situation, maybe someone can give some insight.
Say I want to have input which is comma separated array (e.g.
paths='path1,path2,path3') and convert it to the desired output - list:
import argpa
utput - list:
This is a single argument.
> Now the second case. I want input to be space separated array - bash array.
> And I want space-separated string returned. My current approach is:
> import argparse
> parser = argparse.ArgumentParser()
> parser.add_argument('path
Hi all,
I have a situation, maybe someone can give some insight.
Say I want to have input which is comma separated array (e.g.
paths='path1,path2,path3') and convert it to the desired output - list:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('paths&
e name or
>>> signature of that method changes (even if it does work with all current
>>> versions, it might break in future).
Your are right to be concerned, that’s why I still think, might the `argparse`
can provide a more stable way which can set such format strategy global
However, I hope the message can be as the following:
```
usage: test.py [-h]
test.py: error: the following arguments are required: path
```
The `metavar` argument to `add_argument` can be used to control how an
argument is represented in the usage text:
```
import argparse
parser = arg
If we have the following code:
```
parser = argparse.ArgumentParser(description="test")
parser.add_argument('path')
```
Run it without args, will get error message:
```
usage: test.py [-h] path
test.py: error: the following arguments are required: path
```
However, I hope the message can be as th
")
This works, but is there a more elegant way to achieve it?
It may be sufficient to specify a metavar:
>>> import argparse
>>> p = argparse.ArgumentParser()
>>> p.add_argument("--foo", choices="alpha beta gamma".split(),
metavar=""
On 29Jan2023 08:10, avi.e.gr...@gmail.com wrote:
You are technically correct but perhaps off the mark.
Yes, a python program only sees what is handed to it by some shell if invoked a
certain way.
The issue here is what you tell people using your program about what they need
to type to get it
On 29Jan2023 07:12, 2qdxy4rzwzuui...@potatochowder.com
<2qdxy4rzwzuui...@potatochowder.com> wrote:
On 2023-01-29 at 16:51:20 +1100,
Cameron Simpson wrote:
They're unrelated. As others have mentioned, "--" is _extremely_
common;
almost _all_ UNIX command like programmes which handle -* style o
This thread has run its course and seems to now be generating more heat than
light.
It is now closed (at least on the Python List side).
Thank you everyone for your participation and understanding.
--
~Ethan~
Moderator
--
https://mail.python.org/mailman/listinfo/python-list
quot;-" for options anyway). But more to the point, it is a
feature that is implemented under your application's control (if you
don't want this feature, don't use argparse). Use of "--" is applicable
regardless of which shell your user calls it from, and other
\Works\Python>py
Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import argparse
parser = argparse.ArgumentParser(description='Con
Also fail in REPL,
>
> e:\Works\Python>py
> Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> impor
On 2023-01-27 21:03:39 -0800, Jach Feng wrote:
> I have to admit that I don't know the background upon which the
> argparse was built. The good side is that I don't carry its historical
> knowledge ( or burden?), that's why I can use it in a new way
I don't see what
On 2023-01-29 07:59:21 -0500, avi.e.gr...@gmail.com wrote:
> Although today you could say POSIX is the reason for many things including
> the use of "--" I hesitate to mention I and many others used that convention
> long before as a standard part of many UNIX utilities.
I somewhat doubt that you
"--" ...
-Original Message-
From: Python-list On
Behalf Of Cameron Simpson
Sent: Sunday, January 29, 2023 12:51 AM
To: python-list@python.org
Subject: Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?
On 28Jan2023 18:55, Jach Feng wrote:
>Mark Bour
tandardize, ...
-Original Message-
From: Python-list On
Behalf Of 2qdxy4rzwzuui...@potatochowder.com
Sent: Sunday, January 29, 2023 7:12 AM
To: python-list@python.org
Subject: Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string
argument?
On 2023-01-29 at 16:51:20 +1100,
Ca
On 2023-01-29 at 16:51:20 +1100,
Cameron Simpson wrote:
> They're unrelated. As others have mentioned, "--" is _extremely_ common;
> almost _all_ UNIX command like programmes which handle -* style options
> honour the "--" convention. _argparse_ itself honours that convention, as
> does getopt et
On 28Jan2023 18:55, Jach Feng wrote:
Mark Bourne 在 2023年1月28日 星期六晚上10:00:01 [UTC+8] 的信中寫道:
I notice you explain the need to enclose the equation in quotes if it
contains spaces. That's not even a feature of your application, but of
the shell used to call it. So why so much objection to explaini
o the subprocess spawner).
Maybe you come from Windows, where there are fewer conventions and
less shell parsing, but argparse follows Unix conventions, so if you
don't want Unix conventions, don't use argparse. Just read sys.argv
directly.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
to do what you want.
-Original Message-
From: Python-list On
Behalf Of Jach Feng
Sent: Saturday, January 28, 2023 12:04 AM
To: python-list@python.org
Subject: Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?
Jach Feng 在 2023年1月22日 星期日上午11:11:22 [UTC+8]
C v.1928 32
> >> bit (Intel)] on win32
> >> Type "help", "copyright", "credits" or "license" for more information.
> >>>>> import argparse
> >>>>> parser = argparse.ArgumentParser(description='Convert
Also fail in REPL,
>
> e:\Works\Python>py
> Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> impor
\Works\Python>py
Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import argparse
parser = argparse.ArgumentParser(description='Con
On 1/25/23 19:50, Jach Feng wrote:
> To me, argparse has been just a tool which I can use in a CLI app.
argparse is just a tool for dealing with command-line *flags*, which are
common in command-line tools. argparse interprets the command line as a
bunch of flags because that's w
-h still shows all the contents of pytz.all_timezones.
Adding a few arguments makes it work (with the help of the argparse doc
page and Stack Overflow:
https://stackoverflow.com/questions/14950964/overriding-default-argparse-h-behaviour):
import argparse
import pytz
HELP ="""
Hello Cameron,
On Fri, Jan 27, 2023 at 4:45 PM Cameron Simpson wrote:
>
> On 27Jan2023 15:31, Ivan "Rambius" Ivanov
> wrote:
> >I am developing a script that accepts a time zone as an option. The
> >time zone can be any from pytz.all_timezones. I have
> >
> >def main():
> >parser = argparse
On 27Jan2023 15:31, Ivan "Rambius" Ivanov wrote:
I am developing a script that accepts a time zone as an option. The
time zone can be any from pytz.all_timezones. I have
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-z", "--zone", choices=pytz.all_timezones)
[...]
y, January 27, 2023 at 3:33 PM
> To: Python
> Subject: Custom help format for a choice argparse argument
>
> *** Attention: This is an external email. Use caution responding, opening
> attachments or clicking on links. ***
>
> Hello,
>
> I am developing a script that accepts
van "Rambius" Ivanov
Date: Friday, January 27, 2023 at 3:33 PM
To: Python
Subject: Custom help format for a choice argparse argument
*** Attention: This is an external email. Use caution responding, opening
attachments or clicking on links. ***
Hello,
I am developing a script that ac
Hello,
I am developing a script that accepts a time zone as an option. The
time zone can be any from pytz.all_timezones. I have
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-z", "--zone", choices=pytz.all_timezones)
args = parser.parse_args()
print(args)
On 1/24/23 23:28, Jach Feng wrote:
Chris Angelico 在 2023年1月25日 星期三下午1:16:25 [UTC+8] 的信中寫道:
On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote:
I was happy working with argparse during implement my script. To save the
typing, I used a default equation for testing.
sample = "-4^2+5.3*abs(-2
On Thu, 26 Jan 2023 at 14:13, Jach Feng wrote:
> Now I understand some oppose this idea and saying that you shouldn't use a
> kitchen knife to cut a cake:-)
You shouldn't use a chainsaw to cut a cake, and then ask us why
cake-cutting is so noisy.
ChrisA
--
https://mail.python.org/mailman/listi
Also fail in REPL,
>
> e:\Works\Python>py
> Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> impor
On Thu, 26 Jan 2023 at 04:24, Jach Feng wrote:
> Chris Angelico 在 2023年1月25日 星期三下午1:16:25 [UTC+8] 的信中寫道:
> > On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote:
> > You're still not really using argparse as an argument parser. Why not
> > just do your own -h checking? Stop
ult, controlling the number of arguments and the like.
From: Python-list on
behalf of Jach Feng
Date: Wednesday, January 25, 2023 at 12:25 PM
To: python-list@python.org
Subject: Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?
*** Attention: This is an external
On Thu, 26 Jan 2023 at 04:25, Jach Feng wrote:
>
> Chris Angelico 在 2023年1月25日 星期三下午1:16:25 [UTC+8] 的信中寫道:
> > On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote:
> > > I was happy working with argparse during implement my script. To save the
> > > typing, I used
Chris Angelico 在 2023年1月25日 星期三下午1:16:25 [UTC+8] 的信中寫道:
> On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote:
> > I was happy working with argparse during implement my script. To save the
> > typing, I used a default equation for testing.
> >
> > sample = "-4^2+5
On 25Jan2023 16:15, Chris Angelico wrote:
On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote:
I was happy working with argparse during implement my script. To save the
typing, I used a default equation for testing.
Sure, but what benefit was it bringing you? Just the usage (help)
message? Did
On Wed, 25 Jan 2023 at 14:42, Jach Feng wrote:
> I was happy working with argparse during implement my script. To save the
> typing, I used a default equation for testing.
>
> sample = "-4^2+5.3*abs(-2-1)/2, abs(Abc)*(B+C)/D, (-3) *
> sqrt(1-(x1/7)*(y1/7)) * sqrt(abs((x0-4.5
Also fail in REPL,
>
> e:\Works\Python>py
> Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> impor
g the issue.
> -Original Message-
> From: Python-list On
> Behalf Of Jach Feng
> Sent: Tuesday, January 24, 2023 2:21 AM
> To: pytho...@python.org
> Subject: Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string
> argument?
> cameron...@gmai
Michael Torrie 在 2023年1月25日 星期三凌晨3:05:44 [UTC+8] 的信中寫道:
> On 1/23/23 18:58, Jach Feng wrote:
> > More pathonic, but don't work. The '--' must be at index 1:-)
> I'm very confused. Why are you even using argparse, since if you put --
> at index 1 then argpars
On Tue, 24 Jan 2023 15:13:33 + (UTC), Mike Baskin
declaimed the following:
>Can you stop please
>
Stop what?
You appear to be subscribed to the Python mailing list -- as such you
WILL receive all traffic that appears on that list. There is nothing we can
do. It is not a pers
pression are evaluated or changed before python is even
invoked.
Then again, I may be misunderstanding the issue.
-Original Message-
From: Python-list On
Behalf Of Jach Feng
Sent: Tuesday, January 24, 2023 2:21 AM
To: python-list@python.org
Subject: Re: How to make argparse accep
an argument. So the user is expected to type:
>>>>
>>>> your_script -x -y -- "-4^2+5.3*abs(-2-1)/2"
>>>>
>>>> where there are -x and -y options, then end of options, then an
>>>> argument, which would look like an option if the
nized arguments: -4.3+5
This error doesn't look like "-4.3+5 looks like an option" but instead
"we don't expect any arguments after "infix".
Not personally a fan of argparse myself, but then I have my own
elaborate command line framework which generally uses
This error doesn't look like "-4.3+5 looks like an option" but instead
> "we don't expect any arguments after "infix".
>
> Not personally a fan of argparse myself, but then I have my own
> elaborate command line framework which generally uses getopt
On 1/23/23 18:58, Jach Feng wrote:
> More pathonic, but don't work. The '--' must be at index 1:-)
I'm very confused. Why are you even using argparse, since if you put --
at index 1 then argparse wont't do any argument parsing at all. If all
you want is the expressi
I understand we all want to be helpful and friendly, but it seems to me that
helping someone use the wrong tool for the job isn’t really helpful in the long
run.
argparse is for parsing command line arguments. It’s the wrong tool for this
job.
As Chris Angelico already said: This entire
o type:
>>>>
>>>> your_script -x -y -- "-4^2+5.3*abs(-2-1)/2"
>>>>
>>>> where there are -x and -y options, then end of options, then an
>>>> argument, which would look like an option if there was
if there wasn't the "--"
argument.
And if you DON'T expect the user to enter the "--", then why use
argparse? You can just check argv directly to get your arguments.
This entire thread is a massive "how can I use X to do Y?" problem.
ChrisA
The '--' req
ect any arguments after "infix".
Not personally a fan of argparse myself, but then I have my own
elaborate command line framework which generally uses getopt for the
option stuff.
Cheers,
Cameron Simpson
--
https://mail.python.org/mailman/listinfo/python-list
>> args = parser.parse_args()
> If you do that, you'll never be able to have any actual options, so
> using argparse seems like overkill. Just pull the argument out of
> argv directly.
>
> --
> Greg
Any easy way to "pull the argument out of argv directly" before parse_args()?:-)
--
https://mail.python.org/mailman/listinfo/python-list
ptions, then end of options, then an
> > > argument, which would look like an option if there wasn't the "--"
> > > argument.
> > And if you DON'T expect the user to enter the "--", then why use
> > argparse? You can just check argv di
re wasn't the "--"
> > argument.
> And if you DON'T expect the user to enter the "--", then why use
> argparse? You can just check argv directly to get your arguments.
>
> This entire thread is a massive "how can I use X to do Y?" prob
tual arguments) will work until your
> program actually has options.
> > 2) By adding an extra space character before the leading '-' sign, ie.
> > e:\Works\Python>py infix2postfix.py " -4^2+5.3*abs(-2-1)/2"
> > -4 2 ^ 5.3 -2 1 - abs * 2 / +
> >
On 2023-01-22 at 18:19:13 -0800,
Jach Feng wrote:
1) Modify the sys.argv by inserting an item '--' before parsing it, ie.
sys.argv.insert(1, '--')
args = parser.parse_args()
If you do that, you'll never be able to have any actual options, so
using argparse seems lik
> your_script -x -y -- "-4^2+5.3*abs(-2-1)/2"
>
> where there are -x and -y options, then end of options, then an
> argument, which would look like an option if there wasn't the "--"
> argument.
And if you DON'T expect the user to enter the &qu
On 23Jan2023 13:46, 2qdxy4rzwzuui...@potatochowder.com
<2qdxy4rzwzuui...@potatochowder.com> wrote:
On 2023-01-22 at 18:19:13 -0800,
Jach Feng wrote:
1) Modify the sys.argv by inserting an item '--' before parsing it,
ie.
sys.argv.insert(1, '--')
args = parser.parse_args()
Please don't do th
ign, ie.
> e:\Works\Python>py infix2postfix.py " -4^2+5.3*abs(-2-1)/2"
> -4 2 ^ 5.3 -2 1 - abs * 2 / +
>
> But no idea how it works? and if it can survive in a newer argparse
> version?:-)
It works because argparse checks the first character of each argument,
a
Also fail in REPL,
>
> e:\Works\Python>py
> Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> impor
On 2023-01-22, Weatherby,Gerard wrote:
> Argparse is for parsing command line arguments and options.
>
> If you just want to evaluate an Python expression, use eval( )
Only use eval() if the expression is always under your control (and
you don't make mistakes when typing).
Don
s.
Haha. Yes a nice exercise, but has nothing to do with the original
question which is how to convince argparse to accept a string like that
without thinking it's a switch. Many unix utilities treat "--" as a
special argument that turns off argument parsing for the rest of the
co
the
script parsing the options. I'm pretty sure argparse gives that support
for free, as does getopt and probably any others implementing "normal
UNIXish options".
SO try adding a "--" argument and see how it behaves.
Also fail in REPL,
e:\Works\Python>py
Pytho
Argparse is for parsing command line arguments and options.
If you just want to evaluate an Python expression, use eval( )
Your string isn’t valid Python due to order of operations, but
-(4^2)+5.3*abs(-2-1)/2 is.
From: Python-list on
behalf of Jach Feng
Date: Sunday, January 22, 2023 at 11
On 1/22/2023 10:45 AM, Peter J. Holzer wrote:
Notice that this file is in its first release, version 0.0.1 - the metadata
that says it's 'Development Status :: 5 - Production/Stable' seems to be
bogus. So it may very well be buggy.
It is at least too incomplete to be useful. It handles only sin
Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import argparse
parser = argparse.ArgumentParser(description='Convert infix notation to
postfix')
parser.par
ix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2
> >
> > Also fail in REPL,
> >
> > e:\Works\Python>py
> > Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32
> > bit (Intel)] on win32
> > Type "help&qu
abs(-2-1)/2
[...]
> > > > > import argparse
> > > > > parser = argparse.ArgumentParser(description='Convert infix notation
> > > > > to postfix')
> > > > > parser.parse_args("-4^2+5.3*abs(-2-1)/2")
> > usage: [-h]
&g
8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:08:11) [MSC v.1928 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import argparse
parser = argparse.ArgumentParser(description='Convert infix notation to
po
:11) [MSC v.1928 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
>>> parser = argparse.ArgumentParser(description='Convert infix notation to
>>> postfix
t; detection of the presence of the positional arg to the application.
> >> Shouldn't I be able to tell argparse I'm going to process --verbose, then
> >> exit?
> >
> > ummm, hate to say this, but have you checked the documentation? this
On Sun, 27 Nov 2022 22:23:16 -0600, Karen Park declaimed
the following:
>I figured it out…there was a logistics file given with the assignment! I
>thought it was supposed to be a download included with the python
>download…oops!
>
I think you made this response in the wrong thread...
figure that out. I always get a
>> complaint about the required positional argument.
>> I think I could use something like nargs='*', but that would push
>> off
>> detection of the presence of the positional arg to the application.
>> Shouldn't I be able t
ple action works well enough for
my needs, but it would be nice if more than one such option could be given.
For example:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("url")
parser.add_argument("--version", version="777", action="version
More better:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("positional",type=int)
parser.add_argument('--version',action="version",version="2.0")
args = parser.parse_args()
# double argument
print(args.positional * 2)
From: Pyt
s, but have you checked the documentation? this
>> case is supported using an action named 'version' without doing very much.
>>
>
> Thanks, Mats.
>
> I actually searched all over the argparse docs. (There's a lot to digest.
> Honestly, if I wasn't
>
> ummm, hate to say this, but have you checked the documentation? this
> case is supported using an action named 'version' without doing very much.
>
Thanks, Mats.
I actually searched all over the argparse docs. (There's a lot to digest.
Honestly, if I wasn'
Use two parsers:
import argparse
import sys
vparser = argparse.ArgumentParser(add_help=False)
vparser.add_argument('--version',action="store_true",help="show version")
# look for version, ignore remaining arguments
vargs, _ = vparser.parse_known_args()
if vargs.v
e required positional argument.
I think I could use something like nargs='*', but that would push off
detection of the presence of the positional arg to the application.
Shouldn't I be able to tell argparse I'm going to process --verbose, then
exit?
ummm, hate to say this, but have
7;t occur to me. I looked briefly at the
code for argparse to see how it handled --help. The added argument
seemed normal, so gave up, figuring there was some special handling of
that option.
Skip
--
https://mail.python.org/mailman/listinfo/python-list
I wondered whether subparsers might work, but they don't quite fit here.
This seems to fit the bill fairly well, though I agree it would be
nice if there were a neater option:
import argparse
import sys
VERSION = 0.1
def main(args):
parser.parse_args(args)
class VersionA
could use something like nargs='*', but that would push off
detection of the presence of the positional arg to the application.
Shouldn't I be able to tell argparse I'm going to process --verbose, then
exit?
Thx,
Skip
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 23 Jun 2022 17:01:42 -0600, Mats Wichmann
declaimed the following:
>Assuming: that the "value" in your init method signature was supposed to
>be 'name' since that's what you use later - and would explain your
>exception!
>
Since it is a "named int", I'd expect value to the intege
t; > declaimed the following:
> >
> > >??? wrote at 2022-6-23 15:31 +0300:
> > >>how to solve this (argparse)
> >
> > >>MAXREPEAT = _NamedIntConstant(32,name=str(32))
> > >>TypeError: 'name' is an invalid keyword argument for int()
>
Op 24/06/2022 om 0:32 schreef Dennis Lee Bieber:
On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer"
declaimed the following:
>??? wrote at 2022-6-23 15:31 +0300:
>>how to solve this (argparse)
>>MAXREPEAT = _NamedIntConstant(32,name=str(32))
>>TypeErro
Can you help me for solve it
בתאריך יום שישי, 24 ביוני 2022, מאת Dennis Lee Bieber :
> On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer"
> declaimed the following:
>
> >??? wrote at 2022-6-23 15:31 +0300:
> >>how to solve this (argparse)
>
> >
הודעה שהועברה --
מאת: *Dieter Maurer*
תאריך: יום שישי, 24 ביוני 2022
נושא: argparse modify
אל: נתישטרן
עותק: "python-list-requ...@python.org" , "
python-list@python.org"
נתי שטרן wrote at 2022-6-24 08:28 +0300:
>I copied code from argparse
נתי שטרן wrote at 2022-6-24 08:28 +0300:
>I copied code from argparse library and modified it
>
>בתאריך יום חמישי, 23 ביוני 2022, מאת Dieter Maurer :
>
>> נתי שטרן wrote at 2022-6-23 15:31 +0300:
>> >how to solve this (argparse)
>> >
>> >
>&g
I copied code from argparse library and modified it
בתאריך יום חמישי, 23 ביוני 2022, מאת Dieter Maurer :
> נתי שטרן wrote at 2022-6-23 15:31 +0300:
> >how to solve this (argparse)
> >
> >
> >traceback:
> >Traceback (most recent call last):
> > File "
On Fri, 24 Jun 2022 at 09:03, Mats Wichmann wrote:
> Also note that while it's claimed to be fine These Days, inheriting from
> a base type like this is sometimes tricky, sometimes broken... be
> somewhat aware.
Depends on your definition of "broken". If you want to make a custom
integer type, yo
On 6/23/22 16:32, Dennis Lee Bieber wrote:
> On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer"
> declaimed the following:
>
>> ??? wrote at 2022-6-23 15:31 +0300:
>>> how to solve this (argparse)
>
>>>MAXREPEAT = _NamedIntConstant(32,nam
On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer"
declaimed the following:
>??? wrote at 2022-6-23 15:31 +0300:
>>how to solve this (argparse)
>>MAXREPEAT = _NamedIntConstant(32,name=str(32))
>>TypeError: 'name' is an invalid keyword argumen
נתי שטרן wrote at 2022-6-23 15:31 +0300:
>how to solve this (argparse)
>
>
>traceback:
>Traceback (most recent call last):
> File "u:\oracle\RTR.py", line 10, in
>class sre_constants():
> File "u:\oracle\RTR.py", line 77, in sre_constants
>
how to solve this (argparse)
traceback:
Traceback (most recent call last):
File "u:\oracle\RTR.py", line 10, in
class sre_constants():
File "u:\oracle\RTR.py", line 77, in sre_constants
MAXREPEAT = _NamedIntConstant(32,name=str(32))
TypeError: 'name'
Hi,
With argparse's add_mutually_exclusive_group() I can add mutually
exclusive args, but how do I deal with a 3rd arg which only makes sense
for one of the mutually exclusive args?
More generally I suppose I am interested in having something like
[ --foo (--foobar) | --bar (--barfoo) ]
if th
1 - 100 of 453 matches
Mail list logo