Skip to content

Instantly share code, notes, and snippets.

:electron:
Figuring it out as I go

Chris Fuller sfaleron

:electron:
Figuring it out as I go
Block or report user

Report or block sfaleron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sfaleron
sfaleron / lazyprimes_py3.py
Last active Jul 30, 2019
Infinite prime number generator for Python3
View lazyprimes_py3.py
# Originally from http://logn.org/2009/07/lazy-primes-sieve-in-python.html
# Updated for Python3 by Chris Fuller.
# The automated 2to3 translation doesn't work. The tricky bit is the heap item.
# This is a (int, object) tuple in the original module, but the second element
# becomes a map iterator in Python3, which does not compare, so an exception
# is raised when the heap is sorted.
# It turns out that the object in the original tuple is irrelevant to the sort
# (it compares by memory location, which isn't well defined!). The int deter-
You can’t perform that action at this time.