jacek.generowicz at cern.ch
Mon Mar 22 11:04:30 CET 2004
"John Roth" <newsgroups at jhrothjr.com> writes:
> I personally think that self not only should be a keyword,
> it should not be among the parameters at all. However, I
> seem to be in a distinct minority about that.
The existence of C++ or Java coding guidelines which advocate the
universal use of this->member or the use of m_member for all member
data and function names, is (to me) evidence of the necessity of self.
Also, ask an average[*] C++ programmer whether the following functions
have the same type:
(where A and B are both classes).
In my experience[+], they will, typically, be adamant that the types
are identical. If they have been exposed to Python, then you have more
than a fair chance that they will understand that the types are, in
Python's explicit passing of self makes people understand what is
going on, much better ... and I think that is a very valuable thing.
[*] And we all know just how dangerous "average" C++ programmers are.
[+] You probably don't want to know why I have had ample opportunity
to ask this question, in real life.
More information about the Python-list