A better self
Erik Max Francis
max at alcyone.com
Tue Jul 9 20:36:53 EDT 2002
David LeBlanc wrote:
> Except, of course, "self" is not the name of the first argument, it's
> merely
> the identifier most often used for the first argument.
Sure, my suggestion was not meant to give any preference to `self' as
the Magical Self Argument*; the `.attribute' notation would simply be a
shortcut for `(first variable in argument list).attribute'.
Again, I'm not particularly fond of the proposal, although it certainly
is better than introducing some new punctuation pattern (I've seen
`@attribute' suggested for the same thing), but it doesn't seem right to
me to pretend that . is a legal name and then pretend like it isn't.
> I'm not sure what you meant by ".attribute should have an extra
> space...".
Thinko; I meant to say an extra _dot_, although the example which
followed probably got my point across anyway: If `.' is the self
argument, then its attribute must be referenced by `..attribute', not
`.attribute'.
.
* Perversity of choosing to name it something other than `self' aside, I
seem to recall some official Python documentation somewhere suggesting
that using a name other than `self' is not supported behavior (i.e., a
warning that at some future time its name of `self' might be enforced),
but a few furtive searches from time to time have failed to turn up what
I might have been remembering. Does that ring any bells with anybody?
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ See the son in your bad day / Smell the flowers in the valley
\__/ Chante Moore
Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
A personal guide to Aliens vs. Predator 2.
More information about the Python-list
mailing list