declarations summary

Nick Coghlan ncoghlan at iinet.net.au
Mon Feb 7 08:17:45 EST 2005


Michael Tobis wrote:
> Also there's the question of typo-driven bugs, where an attempted
> rebinding of "epsilon" instead cerated a reference called "epselon".
> (The epselon bug) This is the bane of fortran, and after generations it
> was generally agreed that optionally one could require all references
> to be declared (implicit none). Perl went throgh a similar process and
> implemented a "use strict" module. Experienced Pythonistas are oddly
> resistant to even contemplating this change, though in the Fortran and
> Perl worlds their usage quickly became practically universal.
> 
> I believe that enthusiasm for this construct in other languages is so
> strong that it should be prominently addressed in Python introductions
> and surveys, and that questions in this regard should be expected from
> newbies and patiently addressed. I also don't fully understand the
> profound aversion to this idea.
> 
> I myself am going back and forth on all this. I despise the fact that
> good fortran90 code often has more declarations than executables. Ed
> Ream (LEO's author) pointed out to me the Edward-Tufte-ness of Python.
> No wasted ink (except maybe the colons, which I do sometimes find
> myself forgetting on long edits...)  I don't want Python to look like
> f90. What would be the point?

*If* the rebinding issue were to be addressed for bare names and the right-most 
name in a compound name (the only place where it is currently an issue), I 
imagine it would be by introducing a rebinding augmented assignment operator 
rather than by introducing variable declarations.

Or, more precisely, standard name binding would continue to serve in that role.

For Alex:

I figured out something resembling a justification for the difference in 
semantics between a rebinding operator and the rest of the augmented assignment 
operators: there's no magic method for binding a name, so there is no need for a 
magic method when simply rebinding one, whereas the other augmented assignment 
operators combine the name-binding with an operation which normally *can* be 
overridden, and the augmented assignment magic method is a convenience to allow 
the rebinding case of that operation to be optimised.

Cheers,
Nick.
Do I really want to add another PEP to the snoozing PEP 338, though?

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list