boolean true and false values.

Steve Holden sholden at bellatlantic.net
Tue Jun 27 13:02:57 EDT 2000


Albert Hofkamp wrote:
> 
> On Mon, 26 Jun 2000 22:10 +0100 (BST), Tim Rowe <digitig at cix.co.uk> wrote:
> >In article <slrn8lf3q9.us.hat at se-46.wpa.wtb.tue.nl>,
> >hat at se-46.wpa.wtb.tue.nl (Albert Hofkamp) wrote:
> >
> >> I understand that now.
> >> However, I am not quite sure that that is what one wants.
> >
> >Maybe it isn't; then another language may be more appropriate. When it
> >/is/ what one wants then Python may be your choice.
> 
> :-)
> Changing Python is not my goal, I am only trying to really understand the
> differences between C-like declarations, and the Python approach.
> 
[snip]
> >
> >As can any tool, of course. The dynamic typing is indeed never /needed/
> >(probably one of the things Dijkstra proved!), but it's often very /very/
> >convenient indeed. If it's likely to be a problem to you -- or to the
> 
> Hmm, why is it convenient then ?
> Without declarations you can simply pick another identifier when you need a new
> variable, rather than re-use existing identifiers, which may cause all kind of
> bugs and/or hamper readability.
> 
> Albert
> ---
> Look ma, windows without Windows !!

Dynamically-typed variables are NOT to allow re-use because you want
to save storage by using a variable formerly holding an integer for
a string!

In the C style (as opposed to C++, which like Python was designed to
support object orientation), variables are indeed of specific type,
determinable at compile time.  This allows language-processing rigor
to be used to yield a more efficient executable, ofr example, and
also provides a mental straight-jacket for those who like things to
be just so (:-0).

In Python, other things are interesting about the content of a variable
- such as, for example, "does the object in this variable have a xyzzy()
method?".  In this respect Python and C++ differ, in that C++ is more
disposed to go in for as many compile-time checks as possible that the
method called actualy exists.  Python, using late-binding (the
meaning of a name is interpreted at run-time, and methods are sought
by ascending the class hierarchy at run-time), is a bit freer and easier,
and is prepared to put up with run-time rather than compile-time errors.

Thus, static typing in Python (this variable will hold only this certain
type of thing) while it might offer the ability to optimize aspects of
performance, would (if introduced carelessly) limit the class of useful
programs.  There is no current indication it will be iplemented
carelessly, and I imagine that people like me will be able to proceed
along their happy way never specifying the type of value to which a
variable must refer.

regards
Steve Holden
-- 
Helping people meet their information needs with training and technology.
703 967 0887   sholden at bellatlantic.net   http://home.cox.rr.com/sholden/



More information about the Python-list mailing list