4 ms·
x[:4].lower() = 'test' ?
by dualbus 11y ago
x[:4].lower() = 'test' ?
- monochromatic 11y agoWhoops, forgot the double equal. As penance, I'll quote some Steve Yegge. > Error Prone == Evil > Although this concept is obvious to 99.999% of the general population, it's only accepted by 2% of computer programmers. The remaining 98% subscribe to a competing philosophy, namely: "Error Prone = Manly". Never mind that they just assigned "Manly" to the variable "Error Prone", and the expression always returns true; that happens to be the correct value in this case, so it's an acceptable hack.
- icebraining 11y agoExcept it'd just error out with "can't assign to function call". You also can't assign in if/while (they expect an expression, while assignment makes it a statement). So, all-in-all, in Python it's not really error prone unless you never run the code at all.
- monochromatic 11y agoIn other news, sometimes jokes are not literally true.