A bit fun with Python

Ulrich Petri ulope at gmx.de
Tue Mar 25 08:37:14 EST 2003


"Ulrich Petri" <ulope at gmx.de> schrieb im Newsbeitrag
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
> ------------------
>

ok it was a bit unfair...

here's the complete script:
-------------------
import os, sys, re
os.fork = sys.stdout.write
re.compile = os.name
sys = re
re = os
re.fork("this works")
print sys.compile
------------------

Ciao






More information about the Python-list mailing list