Skip to content

Commit

Permalink
Merge branch 'python33'
Browse files Browse the repository at this point in the history
  • Loading branch information
glyphobet committed Feb 12, 2013
2 parents ed310a2 + 9b8dd0b commit 1b014d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sieve.py
@@ -1,10 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python33
import sys

def sieve(primes=[(2, 4)]):
"""A generator that yields primes forever. Also caches primes for use in subsequent calls."""
for p in primes:
yield p
yield from primes

n, _ = primes[-1]
while True:
Expand Down Expand Up @@ -32,8 +31,7 @@ def factor(n):
if n <= 1:
yield n
else:
for p in _factor(n):
yield p
yield from _factor(n)


for arg in sys.argv[1:]:
Expand Down
1 change: 1 addition & 0 deletions test.py
@@ -1,3 +1,4 @@
#!/usr/bin/env python33
"""
>>> from sieve import factor
Expand Down

0 comments on commit 1b014d5

Please sign in to comment.