Lua operators, why isn’t +=, -= and so on defined?

This is just guesswork on my part, but: 1. It’s hard to implement this in a single-pass compiler Lua’s bytecode compiler is implemented as a single-pass recursive descent parser that immediately generates code. It does not parse to a separate AST structure and then in a second pass convert that to bytecode. This forces some … Read more

Why doesn’t Python have a sign function?

EDIT: Indeed there was a patch which included sign() in math, but it wasn’t accepted, because they didn’t agree on what it should return in all the edge cases (+/-0, +/-nan, etc) So they decided to implement only copysign, which (although more verbose) can be used to delegate to the end user the desired behavior for edge cases – which sometimes might require the call … Read more