Skip to content

Commit

Permalink
gh-97709: Included newline separator in Mandelbrot set (GH-97737)
Browse files Browse the repository at this point in the history
Included newline separator in Mandelbrot set

Now the Mandelbrot set one-liner example on separates the lines with a '\n' character.
(cherry picked from commit 4980260)

Co-authored-by: matheusja <matheusjahnke@hotmail.com>
  • Loading branch information
miss-islington and matheusja committed Oct 4, 2022
1 parent 4591dae commit c62be23
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Doc/faq/programming.rst
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit c62be23

Please sign in to comment.