Class Variable Question
Remco Gerlich
scarblac at pino.selwerd.nl
Mon Apr 9 19:08:06 EDT 2001
Douglas Alan <nessus at mit.edu> wrote in comp.lang.python:
> "Steve Holden" <sholden at holdenweb.com> writes:
>
> > That's correct. Python gives you "enough rope to shoot yourself in
> > the foot", and so does not offer the protection schemes associated
> > with statically-types languages like Java and C++. This increases
> > the flexibility of the language, at the (slight) risk of errors
> > which would not occur in Java or C++.
>
> Actually, there's no extra flexibility than if you used different
> syntaxes for variable initialization and variable assignment.
>
> > There is magic you can do to restrict operations of this kind, but most
> > Python programmers are happy to accept the language as it is, since in
> > practise this doesn't appear to be a problem.
>
> In practice it is a *very* significant problem. This is certainly one
> of the largest sources of bugs. And it is, annoyingly enough, one of
> the few valid complaints that Perl devotees can make against Python.
Huh? In Perl it's even worse. Python will complain if you use a variable it
hasn't heard of, Perl just assumes it has a value of 0...
> > Look at it this way: you can spend the 60% time saving you will make
> > by programming in Python to make sure you have not made such errors!
>
> Why not be honest: It's a wart on the language. But no language is
> perfect and Python is far better than most.
It's absolutely not a wart, it is a strength. Complete programmer freedom is
the *point* of much of Python.
--
Remco Gerlich
More information about the Python-list
mailing list