Another point in favor of the change I just noticed is that int()
accept objects defining __index__ as its `base` argument:


    Python 3.7.2 (default, Jan 13 2019, 12:50:01)
    [Clang 10.0.0 (clang-1000.11.45.5)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> class MyInt:
    ...     def __index__(self):
    ...             return 4
    ...
    >>> int("3", base=MyInt())
    3
    >>> int(MyInt())
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    TypeError: int() argument must be a string, a bytes-like object or
a number, not 'MyInt'
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to