[Python-3000] Enough with the u"string" already!

Christian Heimes lists at cheimes.de
Tue Mar 25 02:10:48 CET 2008


Martin v. Löwis schrieb:
>> Since 2.4  Python uses the AST tree to access the future flags. But the
>> string unicode literals require the information before the AST tree is
>> created.
> 
> "We" should have considered that 2.5 still had to support future
> statements in the parser, for the with_statement, so I think this would
> have been unnecessary.
> 
> Whoever implemented "from __future__ import print_function" knew about
> that, and added it were it belongs (even though the function name
> has the work "hack" in it).

I tried to use the future_hack. However there is no way to access
parser_state->p_flags in PyAST_FromNode(). I don't see a way to get the
information from the parser into the AST code. The current API has no
means to transfer the information. The flags option doesn't do the trick.

Christian


More information about the Python-3000 mailing list