summaryrefslogtreecommitdiffstats
path: root/Doc/faq
diff options
context:
space:
mode:
authormatheusja <matheusjahnke@hotmail.com>2022-10-04 05:34:02 (GMT)
committerGitHub <noreply@github.com>2022-10-04 05:34:02 (GMT)
commit49802605f8e47c5c7ddc8a6cecdf4afe44765586 (patch)
tree48b079d093cdb88294cc59fff57f382aefbf75ab /Doc/faq
parent27e59afa2ad98e6bfe26c6b2b7f6294fa561680c (diff)
downloadcpython-49802605f8e47c5c7ddc8a6cecdf4afe44765586.zip
cpython-49802605f8e47c5c7ddc8a6cecdf4afe44765586.tar.gz
cpython-49802605f8e47c5c7ddc8a6cecdf4afe44765586.tar.bz2
gh-97709: Included newline separator in Mandelbrot set (#97737)
Included newline separator in Mandelbrot set Now the Mandelbrot set one-liner example on separates the lines with a '\n' character.
Diffstat (limited to 'Doc/faq')
-rw-r--r--Doc/faq/programming.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst
index 572a24d..ad281f8 100644
--- a/Doc/faq/programming.rst
+++ b/Doc/faq/programming.rst
@@ -735,7 +735,7 @@ Is it possible to write obfuscated one-liners in Python?
--------------------------------------------------------
Yes. Usually this is done by nesting :keyword:`lambda` within
-:keyword:`!lambda`. See the following three examples, due to Ulf Bartelt::
+:keyword:`!lambda`. See the following three examples, slightly adapted from Ulf Bartelt::
from functools import reduce
@@ -748,7 +748,7 @@ Yes. Usually this is done by nesting :keyword:`lambda` within
f(x,f), range(10))))
# Mandelbrot set
- print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,
+ print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\n'+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