ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Underscore data hiding (was python development practices?)
by Russell E. Owen other posts by this author
Nov 1 2001 4:40PM messages near this date
Re: Underscore data hiding (was python development practices?) | Re: Underscore data hiding (was python development practices?)
In article <9rq2v2$fko$1@[...].nl> ,
 m.faassen@[...].nl (Martijn Faassen) wrote:

> The double underscore is required for name mangling, but I don't really
> like the name mangling; it gets in the way. I just want to give the 
> programmer a hint that some attribute is private, and I use a single
> underscore for this, and many Python programmers with me.
> 
> Why does name mangling get in my way? Generally I like to be able to
> reach the private variables in subclasses (I suppose this makes them
> protected in C++ terms, though my C++ is rusty). I also like being
> able to fake things easily in case I need it, for debugging and
> testing purposes. In the end I only want to indicate something is private
> without all the hassle of name mangling.

Personally, I prefer the effect of double underscore for this case, as 
well. I can easily get to the variables by applying the name mangling 
myself, yet cannot accidentally stomp on the variables in a subclass.

To each his/her own.

-- Russell
-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Peter Wang
Peter Hansen
Toby Dickenson
Tim Peters
Steve Holden
Steve Holden
Cliff Wells
Tim Peters
Martijn Faassen

Cliff Wells
Cliff Wells
Martijn Faassen
Martijn Faassen
Paul Rubin
Russell E. Owen
Barry A. Warsaw
Martijn Faassen
Peter Wang
Skip Montanaro
John Roth
David Bolen
Peter Wang
Peter Wang
Skip Montanaro
Chris Tavares
Darren Collins
David Bolen
Paul Rubin
Paul Rubin
Peter Wang
F Basegmez
Richard Jones

Richard Jones

Neal Norwitz
Graham Ashton
Peter Wang
Russell E. Owen
Skip Montanaro
Cliff Wells
Hung Jung Lu
Wade Leftwich
Peter Wang
Peter Wang


Peter Wang

Chris Gonnerman
Paul Rubin
Andrew Dalke
Paul Rubin
Luigi Ballabio
Paul Rubin
Tim Peters
John Roth
Paul Rubin
Richard Jones

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved