On Aug 31, 5:35 pm, "T. Goodchild" <tgoodch...@gmail.com> wrote:
> I’m new to Python, and I love it.  The philosophy of the language (and
> of the community as a whole) is beautiful to me.
>
> But one of the things that bugs me is the requirement that all class
> methods have 'self' as their first parameter.  On a gut level, to me
> this seems to be at odds with Python’s dedication to simplicity.
>
> For example, consider Python’s indent-sensitive syntax.  Although
> other languages didn’t use indentation to specify scope, programmers
> always used indentation anyways.  Making indentation took a common
> practice, made it a rule, and the result was a significantly improved
> signal-to-noise ratio in the readability of Python code.
>
> So why is 'self' necessary on class methods?  It seems to me that the
> most common practice is that class methods *almost always* operate on
> the instance that called them.  It would make more sense to me if this
> was assumed by default, and for "static" methods (methods that are
> part of a class, but never associated with a specific instance) to be
> labelled instead.
>
> Just curious about the rationale behind this part of the language.

It's required to make distinction between objects inside the calss and
outside of it. Seems pretty logical to me.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to