Le mar. 19 nov. 2019 à 22:12, Pablo Galindo Salgado
<pablog...@gmail.com> a écrit :
> >  Float infinity is replaced with 1e309. Again, maybe someone wants
> to render this differently? It sounds like an arbitrary choice (which
> "works" as expected).
>
> That is not true. float('inf') is rendered as float('inf´):
>
> >>> Unparser(ast.parse("float('inf')"))
> float('inf')

I was thinking at:

>>> Unparser(ast.parse("1e999"))
1e309

Maybe just move the constant as a class attribute, so it can be
overriden in a subclass?

> > I would prefer to keep a separated module, like "import ast.unparse"
> or "import unparse".
>
> Why? I think ast.unparse is a natural fit. It will likely be only one 
> function exposed.

It's mostly to minimize the number of imports on "import ast". unparse
requires extra imports like tokenize which has also tons of
dependencies.

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/YOQEOSIJIVNWIHX42HZ7SZXSEDLTV6VC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to