[docs] doc bug

Michael McLeod mmcleod at pc-1.co.uk
Thu Sep 8 12:17:34 CEST 2011

Where: Programming FAQ
: Is it possible to write obfuscated one-liners in Python?

# Primes < 1000

print(list(filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,

map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))


# Mandelbrot set
print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,
Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,
Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,
i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y
>=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(
))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))


Both use reduce but they now show: 

NameError: global name 'reduce' is not defined



Now  functools  need to be imported.

So now the above should be 2 liners or can you get the import in there?



Michael McLeod

Consultant - ProtoCall One

T:         +44 (0) 800 881 8130

M:        +44 (0) 789 628 2612
F:         +44 (0) 845 466 6005

E:         mmcleod at pc-1.co.uk <mailto:rsherwin at pc-1.co.uk> 
W:        www.pc-1.co.uk

Vote for G-Cloud, the UKs only Genesys-based Hosted Contact Centre
Service, at the Call Centre Helper Top 10 Call Centre Products of the
Year 2011

Winner of Genesys Best Innovation Partner - UK & Ireland Award



The information contained in or attached to this email is intended only
for the use of the individual or entity to which it is addressed. If you
are not the intended recipient, or a person responsible for delivering
it to the intended recipient, you are not authorised to and must not
disclose, copy, distribute, or retain this message or any part of it. It
may contain information which is confidential and/or covered by legal
professional or other privilege (or other rules or laws with similar
effect in jurisdictions outside England and Wales).
The views expressed in this email are not necessarily the views of
ProtoCall One Limited, and the company, its directors, officers or
employees make no representation or accept any liability for its
accuracy or completeness unless expressly stated to the contrary.


This message has been scanned for viruses by McAfee Security As A Service, but
ProtoCall One cannot guarantee that this e-mail or its attachments are virus free
nor accept responsibility for any virus inadvertently transmitted herewith.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110908/bcabd6b5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1538 bytes
Desc: image001.jpg
URL: <http://mail.python.org/pipermail/docs/attachments/20110908/bcabd6b5/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 1274 bytes
Desc: image002.jpg
URL: <http://mail.python.org/pipermail/docs/attachments/20110908/bcabd6b5/attachment-0003.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 5642 bytes
Desc: image003.png
URL: <http://mail.python.org/pipermail/docs/attachments/20110908/bcabd6b5/attachment-0001.png>

More information about the docs mailing list