A bit fun with Python
Don Arnold
dlarnold at west.com
Tue Mar 25 11:42:58 EST 2003
"Ulrich Petri" <ulope at gmx.de> wrote in message news:<b5nvo6$2aio1s$1 at ID-67890.news.dfncis.de>...
> a little riddle:
>
> how does this script:
> ------------------
> re.fork("this works")
> print sys.compile
> ------------------
> produce that output:
>
> ------------------
> this works
> posix
> ------------------
>
> ;)
>
> Ciao Ulrich
This is close:
import sys
import re
re.fork = sys.stdout.write
sys.compile = sys.platform
re.fork('this works\n') # '\n' added
print sys.compile
[begin output]
this works
win32
[end output]
Of course, just because you _can_ do crap like this, you'd have to be
nuts (or a '1337 h4xor' wannabe) to want to.
Don
More information about the Python-list
mailing list