[issue32892] Remove specific constant AST types in favor of ast.Constant

Serhiy Storchaka report at bugs.python.org
Wed Feb 21 06:08:43 EST 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Right, they shouldn't be just aliases, but Constant subclasses with __new__ which return Constant and __instancecheck__ which checks the type of the value. And the Constant class should have writable properties n and s. All these operations should emit a deprecation warning at runtime. Even this doesn't preserve perfect compatibility. issubclass(type(node), Num) will not work, and compile(Num('123')) will raise en exception in the Num constructor instead of compile().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32892>
_______________________________________


More information about the Python-bugs-list mailing list