python improvements (Was: Re: New Language)

Martijn Faassen m.faassen at vet.uu.nl
Fri May 12 18:07:00 EDT 2000


Steven D. Arnold <stevena at permanent.cc> wrote:
[snip]
> 1. I'd like an equivalent to perl's "use strict" pragma.  It's annoying to 
> have to be so paranoid about making a typo in a variable name.  I'd like 
> the compiler to be able to catch those errors for me.

How exactly would this work? It would seem hard to make this work
right in a dynamic language, but perhaps I'm missing some simple
strategies. I'm not familiar enough with 'use strict' in Perl to know
what Perl is doing in this respect. It'd be nice to have a bit
more compile-time checking, but Python's extremely dynamic, so this
would seem very hard to do in the general case. Perhaps for
local and variables it'd be possible, but attributes are tougher;
we have __getattr__(), after all.

> 2. I'd like the ability to specify that a certain parameter or variable is 
> of a given type.
[snip]

Ooh, lots of us would! Join the types-SIG. :)

This is not a small project, and has many consequences, though the
run-time variety would be easier to do than the static-type checking
variety. (which would report type errors during compile-time).

We have OPT, ERR and DOC reasons for doing type checking:

OPT -- the interpreter/compiler uses the type declarations to make our
       code run faster. The more static the type checking, the better.

ERR -- we get more robust code as the types are checked. It's nice when
       this happens during compile-time, though run-time can also be
       helpful.

DOC -- we get more readable code as we can see which types go into a 
       function.

You seem to want DOC and ERR mostly.

There's also a counter force, let's call it RAD:

RAD -- we want to develop our systems rapidly. We want interfaces that can
       deal with lots of inputs, without having to think about it a lot.
       Dynamic typing helps us set these up without hassle.

> 3. I'd like to allow for the formal declaration of protocols a la 
> Objective-C.  A protocol is a set of method calls that an object can claim 
> to support or not.
[snip]

Ah, these are also called 'interfaces' in other languages. See again the
types-SIG for this, though its agenda has been changed some so interfaces
aren't the central part of the discussion. I do expect a form of 
interfaces to emerge at one point, possibly first from the Zope community,
see this page:

http://www.zope.org/Members/jim/PythonInterfaces/Interface

And click on 'release information'.

Also study the types-sig information on www.python.org for much
more on these topics.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list