Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Michael Torrie
On 1/22/23 11:44, Stefan Ram wrote: > Jach Feng writes: >> e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > > Well, it's a nice exercise! But I only made it work for the > specific example given. I have not tested whether it always > works. Haha. Yes a nice exercise, but has n

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Cameron Simpson
On 21Jan2023 19:11, Jach Feng wrote: Fail on command line, e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" usage: infix2postfix.py [-h] [infix] infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 The usual convention for having "nonoption" arguments beginning with

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Weatherby,Gerard
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:2

Re: tree representation of Python data

2023-01-22 Thread Thomas Passin
On 1/21/2023 10:03 AM, Dino wrote: I have a question that is a bit of a shot in the dark. I have this nice bash utility installed: $ tree -d unit/ unit/ ├── mocks ├── plugins │   ├── ast │   ├── editor │   ├── editor-autosuggest │   ├── editor-metadata │   ├── json-schema-validator │   │   └─

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Thomas Passin
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

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Mark Bourne
Jach Feng wrote: Fail on command line, e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" usage: infix2postfix.py [-h] [infix] infix2postfix.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:

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Jach Feng
Thomas Passin 在 2023年1月22日 星期日下午1:30:39 [UTC+8] 的信中寫道: > On 1/21/2023 10:11 PM, Jach Feng wrote: > > Fail on command line, > > > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > > usage: infix2postfix.py [-h] [infix] > > infix2postfix.py: error: unrecognized arguments: -4^2+5.3*a

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-22 Thread Peter J. Holzer
On 2023-01-22 00:30:07 -0500, Thomas Passin wrote: > On 1/21/2023 10:11 PM, Jach Feng wrote: > > e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > > usage: infix2postfix.py [-h] [infix] > > infix2postfix.py: error: unrecognized arguments: -4^2+5.3*abs(-2-1)/2 [...] > > > > > import argpa