By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,564 Members | 954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,564 IT Pros & Developers. It's quick & easy.

Re: Reasoning behind 'self' parameter in classes?

P: n/a
Robert Dailey wrote:
This is an example of a response I'm looking for:
"The self parameter is required because the parser is a bit old and
needs to know the exact object you're referencing"

This is _not_ an example of what I'm looking for:
"Specifying self is a great mysterious thing that we should never
question. Do not question the language! The language is mighty! Don't
bring C++ to Python!"
Fredrik Lundh has written a very clear explanation of this at
http://effbot.org/pyfaq/why-must-sel...-and-calls.htm

(or http://bit.ly/3EUiCf if you don't feel like stitching that URL back
together...)

Jul 30 '08 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Brett g Porter:
Fredrik Lundh has written a very clear explanation of this athttp://effbot.org/pyfaq/why-must-self-be-used-explicitly-in-method-de...
Today lot of people know that Ruby exists, so such FAQ explanation
must explain why Python doesn't use a shorter syntax like for example
@foo to denote instance attributes (and maybe @@baz for the class
attributes).

Bye,
bearophile
Jul 30 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.