29.05.20 14:22, Serhiy Storchaka пише:
I prefer it to be an alternative float constructor. We can also add the corresponding constructor for complex, and add constructors which accept only str, bytes or bytes-like object (i.e. parse a text representation of the number). See also previous discussion about alternative constructors. [1]
I can explain. It is not just style preference. The problem is that we have more than one numeric type. We have operator.index, and we can add operator.as_float and operator.as_complex. But what about Decimal and Fraction? And third-party numeric types? It would be impractical to make the operator module depending on the decimal and fractions modules.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/MD7KO7RRJTMZVBLWRB5HO4PR7RRDMQHG/ Code of Conduct: http://python.org/psf/codeofconduct/