lebrice / SimpleParsing

Simple, Elegant, Typed Argument Parsing with argparse
MIT License
401 stars 50 forks source link

Allowing a float arg to get an int value (according to PEP 3141) #76

Closed Ozziko closed 3 years ago

Ozziko commented 3 years ago

PEP 3141 defines Python's numeric tower... when an argument is annotated as having type float, an argument of type int is acceptable; similar, for an argument annotated as having type complex, arguments of type float or int are acceptable.

Can you please make simple-parsing behave according to PEP 3141, or at least accept int values also for args whose type hint in the dataclass is float? Much more intuitive...

Thanks, you're awesome!