Better HN
topnewbestaskshowjobs
Log inSign up

philipLutz

5 karma · joined May 6, 2023 (3y ago) · 4 submissions

Submissions

comment 1y ago · link · parent

Find and replace "Equity" with "1337"?

comment 3y ago · link · parent

"I can't try to rewrite it in C++ or Rust for now, due to the lack of generator support; the yield statement is what makes this code so nice and elegant, and alternative idioms are much less convenient."

comment 3y ago · link · parent

I enjoyed this, but I am a little stuck on how stuck the author is on yield. If one ends up creating a large list of prime numbers with this generator, why not just return a large list of prime numbers? The author clearly notes how optimizing Python code is "odd" when you can more easily switch languages, but languages like C/C++/Rust would not have pretty code because it does not have yield. It is obvious that returning an array of prime numbers is what one would do in C/C++/Rust.

I understand that not using yield would mean it is not strictly a "generator", but the spirit of this problem is generating the sequence of primes (unless I am missing something).

comment 3y ago · link · parent

there is no silver bullet