Semantics question...

Francis Glassborow francis at robinton.demon.co.uk
Thu May 18 00:31:16 CEST 2000


In article <3921CA22.6458AB08 at webamused.com>, Joshua Macy
<amused at webamused.com> writes
>  Essentially, to make instance members visually distinct from method
>locals.  The other OO languages you're thinking of put an implicit
>"this." in front of (some) accesses within a method, leading to
>confusion (at least sometimes) about to whom internal_data belongs.  OO
>programmers in those languages will then resort to things like naming
>conventions (e.g. preceding all local names with m_) to help them
>remember. Python's design disfavors such under the covers "help", so
>requires that you explicitly pass in a reference to the object as the
>first parameter (traditionally called "self"), and fully qualify member
>access.

Now I could be entirely wrong, but I think the real reason is that
Python has no concept of declarations and so there is no form of name
hiding. There is much to be said for Python's identifiers but they do
not come cost free.  Without declarations the concept of scope and
lifetime are significantly different.


Francis Glassborow      Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation



More information about the Python-list mailing list