## Rate my obsfucated code?

A forum for general discussion of the Python programming language.

### Rate my obsfucated code?

This is what the sieve looks like:
Code: Select all
def prime_sieve(upper):
'''
prime_sieve(upper) -> list of primes up to upper (not including)
'''
nums = range(upper)
p = 2
end = pow(upper, 0.5) + 1
while p < end:
for m in xrange(p + p, upper, p):
nums[m] = 0
while True:
p += 1
if nums[p]:
break
return [n for n in nums[2:] if n]

And after about an hour this is what I got. It's a good bit slower but I think it's because of the j function which is what "marks of multiples of p".

Code: Select all
def j(f): f[1][f[0]] = 0
def p1(upper):
return (lambda q:[z for z in (lambda h:[map((lambda x: None if not x[1] else map(lambda l: j(l),[(t,h) for t in range(x[1]*2,len(x[0]),x[1])])), [(h,s) for s in h[2:int(int(len(h)**0.5)+1)]]),h][1])(range(q))[2:] if z])(upper)
russ

Posts: 18
Joined: Sat Mar 02, 2013 8:59 am

### Re: Rate my obsfucated code?

Code: Select all
float('-inf')
-inf
Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

Yoriz

Posts: 1672
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

### Re: Rate my obsfucated code?

Which law does it violate, the rate my code question or the act ot trying to obfuscate python? probably both
russ

Posts: 18
Joined: Sat Mar 02, 2013 8:59 am