A lot of it comes down to default DWIMmery not being a core Python ideal. It's not just that hash key access and named parameters must normally exist (unless you explicitly indicate differently using defaultdict or a **kwargs parameter). There's also no autovivification, numbers cannot be concatinated to strings unless explicitly converted, if there's an error it will throw an exception by default rather than continuing to run without complaint, and lots of other little differences that spring from the differing philosophies of the languages. There are costs, of course, to Doing What I Say, but on balance it avoids whole classes of errors that Perl programmers may hit by default unless they explicitly use strict, etc.
Agreed re Python's scoping (Porculus) although it's gotten much better over the years, with the addition of the nonlocal keyword being the most recent addition.
You can run pychecker or pylint to find errors in sourcecode. The places I can think of offhand where you could get caught with assignments is a/ to non-existent local variables, b/ to non-existent object member variables, c/ to member variables of the wrong object, and d/ to non-existent hash keys. Problems a/ and b/ are lintable. Problems of types c/ and d/ require mindreading to fix (although you could use a frozendict for type d/)
Cheers, -T. (that's more than enough trespass for the moment ;-) | [reply] |