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

Thomas Passin list1 at tompassin.net
Sun Jan 22 11:47:37 EST 2023


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 single
> letters as operands and treats everything else (except parentheses) as an operator, handling
> only +, -, *, / and ^ correctly (actually, ^ is typically right
> associative, so that's arguably wrong, too).

This script is basically useless without some documentation on the 
intended inputs and outputs, and how to invoke it.  The documentation 
could (in the minimal case) have been included in docstrings and 
comments within the script.  As it is, the script seems tantalizing but 
unusable.

Please document your work, even if it's just for yourself!



More information about the Python-list mailing list