Attack a sacred Python Cow

Derek Martin code at pizzashack.org
Sun Jul 27 21:03:40 CEST 2008


On Sat, Jul 26, 2008 at 12:06:05AM -0400, Terry Reedy wrote:
> There is no requirement to have 'self' in the parameter list.  

But there is a requirement to have *something* which refers to the
object instance.  Why can't this be implicit with a keyword defined in
python to refer to it?

> So the proposal would have to be that the compiler scan the function 
> body and decide which dotted name prefix is the one to be implicitly 
> added.  Have fun writing the discovery algorithm.  

That's crazy talk.

> Or the proposal would have to be that 'self' is mandatory for all 
> programmers in all languages.  I think *that* would be pernicious. 
> People are now free to write the more compact 's.sum = s.a + s.b + s.c' 

s = self

There, your problem is fixed.  Besides, in general, it's better
programming practie to use meaningful names, with fairly obvious and
well-understood exceptions.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20080727/64ddb054/attachment.pgp>


More information about the Python-list mailing list