Code Generator written in python

Arnaud Delobelle arnodel at googlemail.com
Thu Jan 14 11:51:25 EST 2010


trzewiczek <trzewiczek at trzewiczek.info> writes:

> On 01/13/2010 05:09 PM, Arnaud Delobelle wrote:
[...]
>> Sure, here are some example of self-evaluating python objects,
>> i.e. for each v below,
>>
>>         v == eval(v)
>>
>> I'm quite proud of the last one.
[...]
>> v = "\"%s\" %% ((r\"%s\",)*2)" % ((r"\"%s\" %% ((r\"%s\",)*2)",)*2)
>>
>> :)
>>
>>    
> If you're proud of the last one, consider moving to Perl. Python is -
> as I heard - about elegance and readability of code...

No thanks.  It's far too easy to write unreadable code in Perl and I
like a challenge :)

Seriously - this is a self-evaluating string, not code for landing a
$1bn rocket on Mars.  Do you expect it to be readable?  I don't.
However, I definitely find a certain elegance to it.

-- 
Arnaud



More information about the Python-list mailing list