Static Typing in Python

Premshree Pillai premshree_python at yahoo.co.in
Wed Mar 17 10:37:27 EST 2004


 --- Dang Griffith <google0 at lazytwinacres.net> wrote:
> On Tue, 16 Mar 2004 02:28:15 +0000 (GMT), Premshree
> Pillai
> <premshree_python at yahoo.co.in> wrote:
> 
> > --- Joe Mason <joe at notcharles.ca> wrote: > In
> article
> >>
>
><mailman.11.1079347355.12241.python-list at python.org>,
> >> Premshree Pillai wrote:
> >> > Err...you probably have the wrong idea of
> static
> >> > typing, I think. Static typing has to do with
> >> explicit
> >> > declaration (initialization) of variables (and
> not
> >> of
> >> > variable types). Like in C, C++, etc, Python
> too
> >> is
> >> 
> >> Is that an official definition from somewhere? 
> >> Cause I always thought
> >> static typing was about variable types.
> >> 
> >> Joe
> >> -- 
> >>
> http://mail.python.org/mailman/listinfo/python-list
> >
> >Hmm...I might have been a little wrong there.
> However,
> >what I wanted to stress was that it's the explicit
> >declaration of the variable that matters (that
> makes
> >static typing what it is).
> 
> Static typing does not have to do with explicit
> declaration.
> As you said earlier, Perl has an option to force
> explicit
> declaration, and yet Perl is not statically typed. 
> Python function
> arguments are explicitly declared, but are
> dynamically typed.

Perl as it is is dynamically typed; the pragma used to
enforce variable declaration is only an *option* and
thus does not decide whether Perl is statically typed
or dynamically typed. Your comment suggests that you
are trying to justify that "Perl can enforce variable
declaration, but still it is dynamically typed", which
is incorrect to suggest.

Oh, and thanks, you have been helpful!

> 
> It seems you want the compiler to complain when a
> previously unused/unnamed/undeclared variable is 
> used on the left side of an equation.  (It already
> complains
> for vars on the right side and in expressions.)
> 
> I think there is value in detecting such problems,
> but I 
> think there is enough evidence in existing Python
> code
> that there is little value to having it *in the
> language 
> itself*.  As other posters have pointed out, there
> are
> other ways of detecting these problems, such as with
> pychecker and PyRex.
> 
> I'm bowing out of this discussion.  I hope I have
> been
> somewhat helpful.  The strong/weak/static/dynamic
> discussion has gone on many times before, and I
> don't
> see it as being particularly relevant to explicit
> declaration.
> 
> 
> I'm pretty sure you have the answer to your
> question.
> Python does not force, or even support, variable
> declaration.
> If you want that, you'll need to look to one of the
> other
> tools mentioned.
> 
> Best wishes in your endeavors,
>     O-O
>         --Daniel 'dang' Griffith
> p.s.
> (Yes, I know Python supports variable/keyword
> arguments 
> to functions, which don't require explicit
> declaration...)
> -- 
> http://mail.python.org/mailman/listinfo/python-list 

=====
-Premshree
[http://www.qiksearch.com/]

________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html




More information about the Python-list mailing list