443,995 Members | 1,217 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,995 IT Pros & Developers. It's quick & easy.

# who said python can't be obsfucated!?

 P: n/a def s(c):return[]if c==[]else s([_ for _ in c[1:]if _=c[0]]) Anyone else got some wonders...? Apr 2 '08 #1
7 Replies

 P: n/a On Apr 2, 2:19 pm, cokofree...@gmail.com wrote: def s(c):return[]if c==[]else s([_ for _ in c[1:]if _=c[0]]) Anyone else got some wonders...? Nope. Apr 2 '08 #2

 P: n/a 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]]) 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 :-) Ciao ---- FB Apr 2 '08 #3

 P: n/a cokofree...: def s(c):return[]if c==[]else s([_ for _ in c[1:]if _=c[0]]) That QuickSort can be written as a lambda too: s=lambda l:[]if l==[]else s([x for x in l[1:]if x=l[0]]) Bye, bearophile Apr 2 '08 #4

 P: n/a co*********@gmail.com wrote: def s(c):return[]if c==[]else s([_ for _ in c[1:]if _=c[0]]) Anyone else got some wonders...? looks like one of castironpi's postings... J^n Apr 2 '08 #5

 P: n/a co*********@gmail.com a écrit : def s(c):return[]if c==[]else s([_ for _ in c[1:]if _=c[0]]) Anyone else got some wonders...? Nothing as bad, but: sig=lambda m:'@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in m.split('@')]) Apr 3 '08 #6

 P: n/a Marco Mariani a écrit : Bruno Desthuilliers wrote: >sig=lambda m:'@'.join(['.'.join([w[::-1] for w in p.split('.')]) for pin m.split('@')]) Pff... you call that a quicksort? Nope, only somewhat obfuscated Python. And it seems it's at least obfuscated enough for you to believe it could be a quicksort implementation !-) Apr 3 '08 #7

 P: n/a Bruno Desthuilliers wrote: >Pff... you call that a quicksort? Nope, only somewhat obfuscated Python. And it seems it's at least obfuscated enough for you to believe it could be a quicksort implementation !-) You're right, but I'm past the quine age and don't bother parsing obfuscated code (*) anymore. (*) outside my day job, that is. Apr 3 '08 #8

### This discussion thread is closed

Replies have been disabled for this discussion.