bart4...@gmail.com wrote:
But the language can also play a part in not allowing certain things to be expressed naturally. So the for-loop in the example has to have a control-variable even if it's not referenced.
If the compiler can recognise when code is "stupid", it's probably capable of doing something more intelligent than just rejecting it outright. E.g. it could notice that a loop variable wasn't used anywhere in the function and optimise it out. And it could recognise x += 1 and emit an ADD_ONE bytecode for it. Etc. -- Greg -- https://mail.python.org/mailman/listinfo/python-list