Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2602
| References | <df2af546-af99-4e69-bc8e-38c21a045a29@z27g2000prz.googlegroups.com> <o%pkp.365$0s5.220@newsfe17.iad> <86k4f9wzgx.fsf@aiuole.stru.polimi.it> |
|---|---|
| Date | 2011-04-05 07:46 +1000 |
| Subject | Re: Fun python 3.2 one-liner |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.20.1301953602.9059.python-list@python.org> (permalink) |
On Tue, Apr 5, 2011 at 6:09 AM, gb <gb@cabiate.it> wrote: > harrismh777 <harrismh777@charter.net> writes: > >> Seriously, these little one liners teach me more about the python >> language in less time than [...] > > def f(x,n,w): return x if n==1 else\ > (lambda x0=f(x[::2],n/2,w[::2]),\ > x1=f(x[1::2],n/2,w[::2]): reduce(lambda a,b: a+b ,\ > zip(*[(x0[k]+w[k]*x1[k],\ > x0[k]-w[k]*x1[k])\ > for k in range(n/2)])))() > > it was a joke of sort played on it.comp.lang.python (Remind me how it is that Python code is more readable than line noise or Perl code?) What sort of parameters does this take? So far all I can figure out is that n is an integer and x and w are sliceables, but I'm not sure whether x and w should be strings or arrays. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Fun python 3.2 one-liner harrismh777 <harrismh777@charter.net> - 2011-03-29 14:00 -0500
Re: Fun python 3.2 one-liner gb <gb@cabiate.it> - 2011-04-04 22:09 +0200
Re: Fun python 3.2 one-liner Chris Angelico <rosuav@gmail.com> - 2011-04-05 07:46 +1000
Re: Fun python 3.2 one-liner Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-04-05 10:16 +1200
Re: Fun python 3.2 one-liner Chris Angelico <rosuav@gmail.com> - 2011-04-05 08:45 +1000
Re: Fun python 3.2 one-liner Emile van Sebille <emile@fenx.com> - 2011-04-04 15:46 -0700
Re: Fun python 3.2 one-liner Giacomo Boffi <giacomo.boffi@polimi.it> - 2011-04-05 07:36 +0200
csiph-web