Static Typing in Python
Premshree Pillai
premshree_python at yahoo.co.in
Sat Mar 13 09:59:42 EST 2004
--- Dang Griffith <google0 at lazytwinacres.net> wrote:
> On Sat, 13 Mar 2004 07:07:50 +0000 (GMT), Premshree
> Pillai
> <premshree_python at yahoo.co.in> wrote:
>
> > --- Jacek Generowicz <jacek.generowicz at cern.ch>
> >Yes, I am aware that Python is dynamically typed,
> and
> >so is Perl, right? In Perl, we have the "use strict
> >vars" pragma to force variable declaration. Is
> there
> >something like it in Python?
>
> No, but you can use pychecker to get similar
> results.
>
> >Don't you think forced variable declaration is an
> >important requirement in a language?
>
> Not really. Forced variable initialization is
> what's important.
> Unlike C, et al, and Perl, variables don't have a
> default
> initial value. If you try reference a variable that
> hasn't been
> initialized ("bound to a value", in python lingo),
> python raises a
> NameError exception.
>
> --dang
> p.s.
> I know technically Perl initializes to 'undef', but
> it's magically
> treated as 0 or an empty string, depending on
> context, so the
> effect is much the same.
> --
> http://mail.python.org/mailman/listinfo/python-list
Not forcing variable initialization does have its
problems. Here's what I mean: http://www.livejournal.com/users/premshree/10624.html?thread=53376#t53376
=====
-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