Abdur-Rahmaan, with greetings,
On 12/03/19 6:45 AM, Abdur-Rahmaan Janhangeer wrote:
> would it be a good idea to add a use strict in py like js?
> recently i was helping someone and that was one annoying part where a typo
> in a var name caused an unintended variable to slip in.
> maybe something like that
> # -*- strict -*-
> # -*- explicit -*-
> could be used to prevent it
We asked for this consideration, in COBOL and FORTRAN, back in the
seventies - when the time between "submitting a job" and the computer
reporting typos was measured in hours, if not 'overnight'. Surely the
computer could auto-correct:
AND ONE TO COUNTER.
The problem with that, is that if the computer does something 'wrong' in
its attempt to be 'right', it would be even more "annoying"!
When we moved to PCs, the 'bright, young, things' pointed-out that
computer-time had become cheap (and staff-time expensive) and that I
should become more inclined to 'throw' my code at the interpreter and
have it 'check for errors'. However, you've pointed-out the 'down-side'
to such practice (even if your experience was accidental)!
Is there any substitute for reviewing one's code with a critical eye -
do the job descriptions say "attention to detail"?
Perhaps there is some happy medium?
More constructively: doesn't every competent programming editor
anticipate data-entry: suggesting variableNMs, python key-words and even
whole constructs, also offer a spelling-checker? I find such, VERY helpful!