declaration of variables?
André Jonsson
tatsujin at spamgoeshere.despammed.om
Sun Feb 16 08:55:48 EST 2003
Jp Calderone wrote:
> "enlightened" language? Hrm. Dynamic, sure... OO, okay... functional,
> sometimes! But "enlightened"?
:-) I mostly meant that Python seems more "aware" than most other languages of
usability and readability. Do those not count?
> Chances are, if you have this kind of error in your program, there will be
> an error, a NameError later on when you try to use "value" and it isn't
> bound. Compile time is almost always essentially the same as runtime, so
> you get the information at about the same time. Even better, if you have
> unit tests that cover this code path, you find out before you even run your
> actual program.
>
> Could the problem be avoided with variable declarations? Yep. Would I
> trade the flexibility of the current system for a small improvement in
> compile-time checking of my code? Nah, I don't think so.
Flexibility? Please explain. To me this just seem error-prone, and a pain in the b*tt.
Also, it may not even be possible to detect by a unit-test, because there may not be
a syntactical error or such that would cause a run-time error, it just "behaves"
strangely (see my example of a _very_ simple case). In a larger program/project this
could get kinda complex. But I guess that kind of stuff aren't supposed to be done in
Python then...
But it appears that pychecker reports this kind of stuff so I'll quit complaining
now... :-)
/André
More information about the Python-list
mailing list