3 ms·
Python allows for overloading these operators, and has dynamic types, so cannot produce the more efficient byte code on load. Most python interpreters also don'
by karatinversion 5y ago
Python allows for overloading these operators, and has dynamic types, so cannot produce the more efficient byte code on load. Most python interpreters also don't have JIT compilers that could do the optimization on the fly.
- chrisseaton 5y agoHmm.. when you compile to byte code you could emit a single POW_MOD instruction, and then dispatch to the more efficient code if both methods remain un-redefined, or call the full methods if one or more has been redefined.