Hacker News new | past | comments | ask | show | jobs | submit | more settler4's comments login

Doesn't the chained version still iterate over all the elements and squares them before taking the first 3 bigger than 5? the second version only goes over the minimum necessary elements and then breaks. How can the first be higher performance?


No, the iterators are "lazy" (pull-based). Both implementations will perform the same amount of work.

Oftentimes the iterator will be faster, though, because the compiler can reason about what you're doing easier with an iterator vs. iterating via manual sequential indexing.


You can buy it as a gift... to 300 of your close friends who are incidentally named like you and live in your house.


At least it's not /r/os


It would be nice to have a sectioin with things that work differently in both languages. For example in python `if []:` evaluates to False while in javascript `if ([]) {` evaluates to True.


Are we broadcasting signals?


Yes, for about a century.


4chans version:

"Ironic shitposting is still shitposting"


No, the original version is actually the 4chan version. "Ironic shitposting is still shitposting" is the distilled version we started using later.

Edit: Ok, I stand corrected. After checking it turns out the HN post is probably the source. It's just I saw it posted in its original form on 4chan most often.


Interesting! For many years on 4chan, that quote can be seen in a daily basis and produced hundreds of memes, which trolls and trolls trolling each other for being trolls. But it in fact was actually originated from Hacker News?! Even more interesting, it was originally intended as an exact critique to the 4chan community, but then completely picked up by 4chan and became part of the collective consensus of 4chan, and now ended up as a self-fulfilling prophecy...

I don't like the shitposts or trolling, but always fascinated by them as a social and psychological phenomenon, and the way how idea travels and spreads.


> (a := b)

Will `with` start using this syntax instead of `b as a`: `with open('foo') as a:` == `with a := open('foo'):`?

Update: found my answer on the pep. `with EXPR as VAR` actually calls `EXPR.__enter__()` so it's not the same.


You mean `with EXPR as VAR` lets `VAR = EXPR.__enter__()`. Because `with EXPR` also calls `EXPR.__enter__()`, so `with VAR := EXPR` would too.

Seems very unnecessary to have both options.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: