Attack a sacred Python Cow
Nikolaus Rath
Nikolaus at rath.org
Mon Jul 28 03:47:58 EDT 2008
"Russ P." <Russ.Paielli at gmail.com> writes:
> The issue here has nothing to do with the inner workings of the Python
> interpreter. The issue is whether an arbitrary name such as "self"
> needs to be supplied by the programmer.
>
> All I am suggesting is that the programmer have the option of
> replacing "self.member" with simply ".member", since the word "self"
> is arbitrary and unnecessary. Otherwise, everything would work
> *EXACTLY* the same as it does now. This would be a shallow syntactical
> change with no effect on the inner workings of Python, but it could
> significantly unclutter code in many instances.
>
> The fact that you seem to think it would change the inner
> functioning of Python just shows that you don't understand the
> proposal.
So how would you translate this into a Python with implicit self, but
without changing the procedure for method resolution?
def will_be_a_method(self, a)
# Do something with self and a
class A:
pass
a = A()
a.method = will_be_a_method
It won't work unless you change the interpreter to magically insert a
'self' variable into the scope of a function when it is called as a
method.
I'm not saying that that's a bad thing, but it certainly requires some
changes to Python's internals.
Best,
-Nikolaus
--
»It is not worth an intelligent man's time to be in the majority.
By definition, there are already enough people to do that.«
-J.H. Hardy
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
More information about the Python-list
mailing list