3 ms·
Also "what is equals?". That's why people will do: def fooer(i: str, strings: list[str]): push = str.append for s in strings: p
by staticassertion 4y ago
Also "what is equals?". That's why people will do:
def fooer(i: str, strings: list[str]):
push = str.append
for s in strings:
push(i, s)
Apparently this helps the interpreter understand that `append` is not getting overwritten in the global scope elsewhere.
- wheelerof4te 4y agoThis is one of the most common optimizations in Python, simply because the lookup code for modules/class instances is horrible and slow.
- staticassertion 4y agoIt'd be nice if there were a tool you could run over your code that did this sort of thing. Even if it can technically break shit in absurd cases, I'd totally run it on my code, which isn't absurd.