]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] gh-97709: Included newline separator in Mandelbrot set (GH-97737) (#97823)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 4 Oct 2022 19:01:07 +0000 (12:01 -0700)
committerGitHub <noreply@github.com>
Tue, 4 Oct 2022 19:01:07 +0000 (12:01 -0700)
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 49802605f8e47c5c7ddc8a6cecdf4afe44765586)

Co-authored-by: matheusja <matheusjahnke@hotmail.com>
Doc/faq/programming.rst
Doc/tools/susp-ignored.csv

index a93fe53c6703992498268662b97220b5cdb691e3..a33774ac9c05b84e492959f8240e2c12cf90ff26 100644 (file)
@@ -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
index 75049783e19c1f15691374f6074f65f2a8150764..c1b27246ca122f5062503025cf6336322108e1d0 100644 (file)
@@ -12,7 +12,7 @@ extending/extending,,:myfunction,"PyArg_ParseTuple(args, ""D:myfunction"", &c);"
 extending/extending,,:set,"if (PyArg_ParseTuple(args, ""O:set_callback"", &temp)) {"
 extending/newtypes,,:call,"if (!PyArg_ParseTuple(args, ""sss:call"", &arg1, &arg2, &arg3)) {"
 faq/programming,,:chr,">=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("
-faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,"
+faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\n'+y,map(lambda y,"
 faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,"
 faq/windows,,:d48eceb,"Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32"
 howto/curses,,:black,"colors when it activates color mode.  They are: 0:black, 1:red,"