Is this possible in Python?
Azolex
cretin at des.alpes.ch
Mon Mar 13 04:02:08 EST 2006
Paul Rubin wrote:
> alainpoint at yahoo.fr writes:
>> assert magic_function(3+4)=="3+4"
>> assert magic_function([i for i in range(10)])=="i for i in range(10)]"
>>
>> It is not trivial at all and might require some bytecode hacking that i
>> am unable to do myself BUT you are the experts ;-)
>
> Guhhh... you'd want to use the traceback system and reach back into
> the source code to get and parse the statement that called the magic
> function, sort of like a debugger does.
That's one way
> I don't think messing with
> the bytecode would help.
Well, the following package
http://packages.debian.org/stable/python/decompyle
might permit something like that.
More information about the Python-list
mailing list