who said python can't be obsfucated!?

Francesco Bochicchio bockman at virgilio.it
Wed Apr 2 19:33:41 CEST 2008

On Wed, 02 Apr 2008 07:19:08 -0700, cokofreedom wrote:

> def s(c):return[]if c==[]else s([_ for _ in c[1:]if _<c[0]])+[c[0]]
> +s([_ for _ in c[1:]if _>=c[0]])
> Anyone else got some wonders...?

Not so good: it took me only one minute to anderstand that is a 
recursive sort ... or it is?

I read it as:
the function s applied to a list is equal to the empty list if the
input list is empty, otherwise it is equal to the result of the function s
applied to all the elements smaller than the first one plus the first
element plus the function sort applied to all the elements greater or
equal to the first one, except the first one itself.

I like the almost one-to-one corrispondence between the code elements and
the components of the sentence describing the function. Now _that_ is
an human-friendly syntax :-)


More information about the Python-list mailing list