python improvements (Was: Re: New Language)
Courageous
jkraska1 at san.rr.com
Fri May 12 20:56:14 EDT 2000
> 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.
This would be useful, albeit for instance vars, you can already do it,
by implementing your own __getattr__ and __setattr__ methods, IIRC.
For that matter, you could probably fudge something like this by
overridding the getattr/setattr methods of the local module namespaces,
albeit I'm pretty new at python and haven't tried it, so... :)
> 2. I'd like the ability to specify that a certain parameter or variable is
> of a given type.
I think that it is inevitable that this sort of optional, declarative
information becomes available in python, particularly as pressure for
mature compiler technology increases.
> 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.
Well, unless I'm misunderstanding you, you can sort of do this now by
implementing methods on a baseclass which, if not overridden, throw
an exception... ?
> Nuff said. Python kicks ass. I'm a convert!
What you said. :)-
C/
More information about the Python-list
mailing list