Adding optional 'explicit' declaration?

Alex Martelli aleaxit at yahoo.com
Wed Apr 25 10:23:33 EDT 2001


"Laurent Pointal" <pointal at lure.u-psud.fr> wrote in message
news:9c63ps$i4h$1 at upsn21.u-psud.fr...
> The idea is to optionnaly allow to force an explicit variable declaration
> in Python functions/methods for compilation time check.
    [snip]
> What do you think of this?

It's a frequently made request (just as for many other deep
changes to Python's philosophy in broad outline AND details --
if 20% of the proposals posted to this group were implemented,
Python would soon be completely unrecognizable, losing all
that distinguishes it from other languages, thus all usefulness).

My personal idea on the matter is that a marginally useful
feature, both in se, and, even more, to better terminate this
particular endless subthread out of the zillion other feature
proposals, would be to endow dictionaries with abilities to
be locked against modifications -- of two kinds: ability to
modify the entry for an existing key, ability to add entries
for new keys, each separately settable.  I could occasionally
use that (right now I have to wrap the dictionary to be
locked into a class instance, and I can't pass the wrapped
dictionary into places requiring a real bonafide dict, such
as a module's __dict__ for controlling variables).  Or else,
letting any mapping be used where now only a true dict
is accepted would be great, too, and maybe more useful
still (it has all other sorts of tricky uses!).

But that, of course, would not give the syntax sugars that
proposers of modifiers are typically keen on, so it would not
abate the unending buzz of modification proposals.  Maybe
making it easier for each proposer to roll his or her own
idiosyncratic Python dialect (syntax sugar above all) would
indeed be the only way out -- if only we could do that on
a separate meant-just-as-lightning-rod-Python-version,
maybe, letting Python's simplicity survive in the main branch...


Alex






More information about the Python-list mailing list