[Python-ideas] .pyu nicode syntax symbols (was Re: Empty set, Empty dict)

Chris Angelico rosuav at gmail.com
Sat Jun 28 09:26:11 CEST 2014


On Sat, Jun 28, 2014 at 3:28 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Jun 28, 2014 at 3:00 PM,  <random832 at fastmail.us> wrote:
>> On Sun, Jun 22, 2014, at 16:18, Terry Reedy wrote:
>>
>>> 2. Write pyu.py. It should first translate x.pyu to the equivalent x.py.
>>
>> What is the equivalent x.py for "BUILD_SET 0" rather than "LOAD_GLOBAL
>> (set), CALL_FUNCTION 0"?
>
> Is there any reason that it has to be normal-looking source code?

Here's a POC translator. Give it a string with the source code for one
function, and it'll give back a string that'll generate a similar
function. Currently assumes it's working at top level - doesn't handle
nested functions, methods, etc, etc. But it seems to work.

https://github.com/Rosuav/shed/blob/master/empty_set.py

ChrisA


More information about the Python-ideas mailing list