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

Peter J. Holzer hjp-python at hjp.at
Sun Jan 29 08:40:09 EST 2023


On 2023-01-29 07:59:21 -0500, avi.e.gross at 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 are remembering correctly. The POSIX standard
was published in 1988. I was starting to use Unix shortly before that
and I don't think there was really a common way to indicate the end of
the options. Some utilities used "-", some "--", some just stopped at
the first argument which didn't look like an option ...

The convergence to "--" happened later. My guess is that GNU getopt and
the popularity of the GNU utilities had a lot to do with it.

> Like many other such things, you build things first and by the time
> you standardize, ...

Right. But in this case lots of people were building different things
and then *one* of them was standardized. Truth to be told, I don't know
when that happened. It might have been in the original 1988 edition of
POSIX, but I don't think so. I think it was in a later (possibly much
later) edition, wennn "--" was already really common. But POSIX did lead
the way in some cases and it might have been the case here, too.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20230129/7466ab02/attachment.sig>


More information about the Python-list mailing list