Getting rid of "self."

John Roth newsgroups at jhrothjr.com
Sun Jan 9 08:50:15 EST 2005


"Alex Martelli" <aleaxit at yahoo.com> wrote in message 
news:1gq4ery.1v79c2t9lsfinN%aleaxit at yahoo.com...
> BJörn Lindqvist <bjourne at gmail.com> wrote:
>
>> I think it would be cool if you could refer to instance variables
>> without prefixing with "self." I know noone else thinks like me so
>
> Some do -- Kent Beck's excellent book on TDD-by-example has a specific
> grouse against that in the chapter where he develops the unittest module
> (in Python).  But that's how comes Kent is a _Smalltalk_ programmer
> rather than a _Python_ programmer, see?-)

And of course, the reason it's possible in Smalltalk but not in Python
is that Smalltalk requires the declaration of instance variables. Also
Smalltalk does not have things like module variables and builtins.
The interpreter knows exactly what every name references, which
isn't true in Python.

John Roth

>
>
> Alex 




More information about the Python-list mailing list