Sure -- I'll try to respond in-depth on this tomorrow.
I was thinking of the specific situation of code like
where you really meant
Reviews may help in detecting such cases, but this kind of mistake is a) difficult for humans to detect (we're annoyingly good at "overlooking" such mistakes because of our overactive pattern matching esp. when reading) and b) hard to detect by testing.
I'd much rather have
throw an exception immediately rather than simply creating a new attribute on "x" named "aFieldName" (and leading to subtle bugs later). This would make such typos much easier to detect in testing since the error would trigger as soon as you hit that line.
You might say I'm a sucker for the mantra of "detect errors/failure as early as possible"... which is not easy with dynamically type checked languages like Python, but every little helps.
I was thinking of the specific situation of code like
Code:
x.aFieldName = 123
Code:
x.aFieldname = 123
I'd much rather have
Code:
x.aFieldName = 123
You might say I'm a sucker for the mantra of "detect errors/failure as early as possible"... which is not easy with dynamically type checked languages like Python, but every little helps.
Comment