Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Why I use private variables (WAS: RE:"private" variablesa.k.a. name mangling?)

Reply
Thread Tools

RE: Why I use private variables (WAS: RE:"private" variablesa.k.a. name mangling?)

 
 
Jeremy Bowers
Guest
Posts: n/a
 
      01-24-2005
On Mon, 24 Jan 2005 15:35:11 -0600, Philippe C. Martin wrote:

> The real reason behind my using private variables is so they do not appear
> in the epydoc generated documentation and confuse my users.


You mean single or double underscores? I just checked and at least epydoc
2.1 doesn't include single-underscore values, but those aren't "private"
in sense we're talking in this thread (some form of compiler enforcement).

 
Reply With Quote
 
 
 
 
Philippe C. Martin
Guest
Posts: n/a
 
      01-24-2005
The real reason behind my using private variables is so they do not
appear in the epydoc generated documentation and confuse my users.

Regards,

Philippe




--
***************************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***************************

 
Reply With Quote
 
 
 
 
Philippe C. Martin
Guest
Posts: n/a
 
      01-24-2005
I used double underscore because I thought it was the correct way to name
private variables/methods - I will have to change those to single
underscore since that it the current methodology.

A private variable to me:
1) is internal to the processing of a class and needs not be accessed by
external or derivated objects. (I won't get into the
potential need of "protected" variables/methods - Python creators have not
made those distinctions for reasons that they believe are good and I'm not
the one to discuss them)
2) Must not be documented to library users as they're using it would
go againts 'law' 1).
3) I wish I had one, but there is only one Isaac Asimov after all

Regards,

Philippe








On Mon, 24 Jan 2005 11:45:34 -0500, Jeremy Bowers wrote:

> On Mon, 24 Jan 2005 15:35:11 -0600, Philippe C. Martin wrote:
>
>> The real reason behind my using private variables is so they do not appear
>> in the epydoc generated documentation and confuse my users.

>
> You mean single or double underscores? I just checked and at least epydoc
> 2.1 doesn't include single-underscore values, but those aren't "private"
> in sense we're talking in this thread (some form of compiler enforcement).


 
Reply With Quote
 
Steven Bethard
Guest
Posts: n/a
 
      01-24-2005
Philippe C. Martin wrote:
> I used double underscore because I thought it was the correct way to name
> private variables/methods - I will have to change those to single
> underscore since that it the current methodology.
>
> A private variable to me:
> 1) is internal to the processing of a class and needs not be accessed by
> external or derivated objects.

[snip]
> 2) Must not be documented to library users as they're using it would
> go againts 'law' 1).


Yeah, I use single-underscores for similar reasons, and so that
PythonWin doesn't show my "private" variables in the drop-down list of
object attributes. I think for most uses, no name-mangling is required...

Of course, I could generate an arbitrary number of "problem cases" -- I
just don't think they happen often in real code...

Steve
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing a private function an keeping access to private variables Gregor Kofler Javascript 6 06-27-2008 10:24 PM
private(true) || private :make_time, what does it do? why? Rie! Ruby 3 03-26-2008 12:40 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
Why is define_method private? Plus,what's the point of private methods? Daniel Finnie Ruby 3 12-16-2006 10:09 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57