[Python-Dev] Symmetry arguments for API expansion (original) (raw)

Larry Hastings larry at hastings.org
Tue Mar 13 04:35:25 EDT 2018


On 03/12/2018 08:41 PM, Guido van Rossum wrote:

If you force me to choose between allowing hex(3.14) or 42.hex() I'll choose the latter

I assume you meant (42).hex() here.  If you're also interested in changing the language to permit 42.hex(), well, color me shocked :D

(For those who haven't seen this before: it's a well-known gotcha. When Python's grammar sees "42.hex()", it thinks "42." is the start of a floating-point constant.  But "42.hex" isn't a valid floating-point constant, so it throws a SyntaxError.)

//arry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180313/3a9a1c4a/attachment.html>



More information about the Python-Dev mailing list