

Your point about it not running when there is nothing to iterate over is incorrect. The else-statement runs when the iterator is exhausted; if the iterator empty, it is exhausted immediately and the else-statement is executed.
Your point about it not running when there is nothing to iterate over is incorrect. The else-statement runs when the iterator is exhausted; if the iterator empty, it is exhausted immediately and the else-statement is executed.
Which makes it easier to keep up the momentum
Buffalo bison that other Buffalo bison bully also bully Buffalo bison.
There are three groups, the bullies, the bullied bullies, and the bullied.
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
I disagree, and would argue that both are about equally frequent. For example, my phone shows °C in the weather widget, while the weather app only uses °. That does not change the fact that the actual unit is °C, and that would not change even if the whole world switched away from °F, and your original comment about the display having °C implying that °F still exists is therefore incorrect.
No, even if you only had one unit for a physical quantity, you would still need to specify that unit to know which physical quantity you are describing. E.g. “That object over there is 15” vs “That object over there is 15 kg”.
The symbol for temperature, measured in Celsius, is “°C”. It’s atomic and can’t be separated, since that would result in °, which represents the angle of something, not the temperature, and C, which is the symbol for Coulomb, which measures electric charge.
As long as it’s maintained. Wrong documentation can often be worse than no documentation.
I was making that reference
Comment should describe “why?”, not “how?”, or “what?”, and only when the “why?” is not intuitive.
The problem with comments arise when you update the code but not the comments. This leads to incorrect comments, which might do more harm than no comments at all.
E.g. Good comment: “This workaround is due to a bug in xyz”
Bad comment: “Set variable x to value y”
Note: this only concerns code comments, docstrings are still a good idea, as long as they are maintained
Not the Doppler effect, as that only applies to moving objects, but instead the inverse square law, where the energy of the sound wave decreases by the square of the distance from the origin, since it spreads in a sphere with the energy being spread across the surface of the sphere, resulting in a very quick dropoff in the loudness.
Isn’t it also partly that as processing power increased, you could do more sophisticated compression/decompression in real time compared to previously, allowing these more complex compression algorithms to actually be viable?
I.e. they actually knew how to do it before, they just didn’t have the power to implement it
Now I imagine them just writing an incoherent string of words. “Tomato car house fireman oven duck garden rice…”
Probably is. If they gave you a little too much anesthesia so you didn’t wake up, you would probably drift off the same, and then just not wake up.
I spent way too long trying to figure out why the guy and the ice cream shop were flying, and how he would move horizontally in he air…
I remember hearing about a study that claimed that backing into parking spaces could have you hundreds of dollars per year, since doing the reversing while the engine is hot uses less gas.
I think it’s fair to say that those in their late teens now are the first generation raised online. Sure, previous generations where raised alongside the internet, but the current generation is raised with a much larger presence of the internet.
I think it does make sense, it’s a “did this loop exit naturally? If so, do x”. This makes a lot of sense if you, for example, have a loop that checks a condition and breaks if that condition is met, e.g. finding the next item in a list. This allows for the else statement to set some default value to indicate that no match was found.
Imo, the feature can be very useful under certain circumstances, but the syntax is very confusing, and thus it’s almost never a good idea to actually use it in code, since it decreases readability a lot for people not intimately familiar with the language.
Edit: Now, this is just guessing, but what I assume happens under the hood is that the else statement is executed when the StopIteration exception is recieved, which happens when next() is called on an exhausted iterator (either empty or fully consumed)