Adi J. Sieker wrote:
Am Fri, 09 Sep 2005 13:10:14 +0200 schrieb Ed Leafe <[EMAIL PROTECTED]>:

On Sep 9, 2005, at 6:25 AM, Adi J. Sieker wrote:

My understanding, is that a single underscore is equivalent to the protected keyword of C++, class methods and sub class methods are allowed access. Two underscores is equivalent to the private
keyword, which means only class methods are allowed access.


That is my understanding, too. So if the method needs to be called from classes outside of dForm, it should be 'registerObject()' and not '_registerObject()'.

That's what I'd say.
_registerObject() should only be called from sub classes of dForm.
Where as registerObject() is part of the public interface of dForm and
can be clled from anyone.

You can take the convention strictly, like a traffic law, and make such a rule, or you can try to sort out the intent of the convention or law and live by that. Whenever I see a _ prefacing an identifier in Python source code, I think "ah, this is something internal to the workings that I'll not concern myself with". And whenever I approach the stop sign at the corner of Monterey and B Streets, and I can see that nobody is around, I don't come to a full and complete stop, which technically breaks the law.

Additionally, documenting tools like epydoc have features that automatically skip publicizing identifiers that begin with _, which sure is handy.

--
Paul McNett
http://paulmcnett.com
http://dabodev.com


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to