I have no class

Steven D'Aprano steve at pearwood.info
Mon Nov 24 05:21:32 CET 2014


On Sun, 23 Nov 2014 09:02:57 -0800, Rustom Mody wrote:

> Python is a bit odd in the OO-world in that it prioritizes "Explicit is
> better than implicit" over convenience.
> 
> Notice that you use self.throw where in most other OOP languages you
> would use just throw.

I don't think that is correct. I think that most OOP languages are like 
Python, and use a special variable to reference the current instance:

"self" is used by:
    Smalltalk, Python, Perl, Objective-C, Swift, Ruby, OCAML

"this" is used by:
    C++, C#, Java, D, Javascript, F#, Cobra, PHP, Powershell

"me" is used by:
    ABAP Objects, Visual Basic

"Current" is used by:
    Eiffel


http://en.wikipedia.org/wiki/This_(computer_programming)


http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(object-
oriented_programming)#Special_variables


In some of these languages, the use of "this/self/me" is optional, but 
I'm not aware of *any* OOP language where there is no named reference to 
the current object at all.

In any case, Python is not unusual in this regard.


-- 
Steven



More information about the Python-list mailing list