Re:Minimal examples of data structures and algorithms in Python
by in9 on Monday April 24, 2017 @10:34PM
(#14190309)
wouldnt this version you suggested, along with the postponed sieve generator, be Numba complaint code?
From a quick read through, i think so.
So then you could achieve, minimal JIT compiled code for your Project Euler problems :D
http://numba.pydata.org/numba-doc/0.18.1/developer/generator...
With minimal code like this, I'm a little torn between declaring a class with members and using an anonymous data structure. A tree for example can be a tuple in python, and doesn't need to be declared. How big do you let it get before taking the time to declare a class?
Re: primes_sieve_of_eratosthenes.py, after doing more primes problems on Project Euler than I care to admit, I ended up with this pretty minimal sieve. The repo's indexing and .append in the loop slow it down.
And total tangent but have you guys seen the amazing and extremely memory efficient postponed sieve generator? http://ideone.com/WFv4f