New Python 3.0 string formatting - really necessary?

Luis Zarrabeitia kyrie at uh.cu
Sun Dec 21 14:54:55 EST 2008


Quoting r <rt8396 at gmail.com>:

> I noticed when i mentioned "self" nobody wants to touch that subject.
> There could be many reasons why...
> 
> 0.) nobody but the 10 regulars i see here exists
> 1.) nobody cares(doubt it)
> 2.) nobody is brave enough to question it(maybe)
> 3.) most people like to type self over and over again(doubt it)
> 4.) most people here have given up on changing the BDFL's mind about
> it. (good possibility)
> 5.) this is a hot-button topic(no doubt in my mind!)

You forgot
6.) it is the best, cleanest, most consistent and extensible way to do it.
 
> This was the reason for using indention over the bracket plague in
> python. REDUNDANCY!!! Why not dump self and make the language cleaner.
> I love python's classes, but HATE self.redundant! This really needs to
> be fixed, and you have not heard the last from me about it!!!

Do you also hate cls.redundant on a classmethod? Would you rather type 'self'
even when it is referring to a class? Would you like to resort to a hack, like
C#3.0's 'this' explicit argument, when monkey-patching?

I used to hate 'self'. Then I met classmethods, metaclasses and decorators, and
the 'new'/'types' modules. It's just one of those examples where Guido's time
machine works flawlessly.

> 3000 would have been the perfect time to dump self and really clean up
> the language, and it's not too late, dawn is not upon us yet.

No need to wait for python 3000.

You can have a 'selfless metaclass' right now:

http://www.voidspace.org.uk/python/articles/metaclasses.shtml

(BTW, I really hope you are complaining about the explicit self on the argument
list, and not about the 'self.' prefix - if that were the case, what magic would
you propose for the compiler to guess when you are referring to locals, globals,
class or instance variables?)


-- 
Luis Zarrabeitia
Facultad de Matemática y Computación, UH
http://profesores.matcom.uh.cu/~kyrie





More information about the Python-list mailing list