Re: I want to see all the variables

2006-12-31 Thread Steven D'Aprano
On Sun, 31 Dec 2006 21:23:03 -0800, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> > At the same time, you should ponder very >> > carefully the reasons why the original author deemed it important to >> > make those attributes private in the first place. >> >> In my experience

Re: I want to see all the variables

2006-12-31 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > > At the same time, you should ponder very > > carefully the reasons why the original author deemed it important to > > make those attributes private in the first place. > > In my experience, it is mostly because they come from > bondage-and-domination

Re: I want to see all the variables

2006-12-31 Thread Steven D'Aprano
On Sun, 31 Dec 2006 19:48:55 -0800, Tom Plunket wrote: > Steven D'Aprano wrote: > >> What does the author of the original class know about *my* needs and >> requirements? > > The only thing that the original class author might know is that mucking > with data marked private may well cause proble

Re: I want to see all the variables

2006-12-31 Thread Tom Plunket
Steven D'Aprano wrote: > What does the author of the original class know about *my* needs and > requirements? The only thing that the original class author might know is that mucking with data marked private may well cause problems, and hiding it therefore prevents those problems. > It may turn

Re: I want to see all the variables

2006-12-30 Thread Steven D'Aprano
On Sun, 31 Dec 2006 03:39:52 +0100, Rene Fleschenberg wrote: > johnf wrote: >> Very detailed. But I was attempting to debug some code which subclassed >> other code. I got a traceback that something like "no >> mySubClass.__source.query() did not exist". > > By (strong) convention, "__" means

Re: I want to see all the variables

2006-12-30 Thread Steven D'Aprano
On Sat, 30 Dec 2006 11:08:10 -0800, johnf wrote: > Very detailed. But I was attempting to debug some code which subclassed > other code. I got a traceback that something like "no > mySubClass.__source.query() did not exist". The superclass had something > like "myClass.__source.query(sql)" which

Re: I want to see all the variables

2006-12-30 Thread Rene Fleschenberg
johnf wrote: > Very detailed. But I was attempting to debug some code which subclassed > other code. I got a traceback that something like "no > mySubClass.__source.query() did not exist". By (strong) convention, "__" means "not to be accessed from outside the class, not even from subclasses".

Re: I want to see all the variables

2006-12-30 Thread johnf
Steven D'Aprano wrote: > > There are three other underscore conventions in use: > > (1) Objects with a single leading underscore like _attribute are private > by convention, but Python doesn't enforce it. Starting an object with a > single underscore is like writing "# Private! Don't touch!" af

Re: I want to see all the variables

2006-12-29 Thread Gabriel Genellina
At Friday 29/12/2006 13:17, Steven D'Aprano wrote: >>> X.__dict__ {'__module__': '__main__', '__doc__': None} >>> X.__name__ 'X' >>> X.__bases__ () Now that's interesting... if __name__ and __bases__ don't live in the class __dict__, where do they live? What other methods and attributes are inv

Re: I want to see all the variables

2006-12-29 Thread Steven D'Aprano
On Fri, 29 Dec 2006 12:04:11 -0800, johnf wrote: > Ok then how do debug when I have something like "__source" and I need to > know what is available for the object? Outside of a class, objects with two leading underscores are just ordinary objects with no special behaviour: >>> __source = 2 >>>

Re: I want to see all the variables

2006-12-29 Thread johnf
Steven D'Aprano wrote: > On Fri, 29 Dec 2006 08:20:22 -0600, Larry Bates wrote: > >> johnf wrote: >>> Hi, >>> When I use dir() I don't see the __ underscore items. Is there anything >>> that will show all the private vars and functions? >>> >>> johnf >> >> The idea of the underscore items is t

Re: I want to see all the variables

2006-12-29 Thread [EMAIL PROTECTED]
On Dec 29, 5:17 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 29 Dec 2006 07:57:30 -0800, [EMAIL PROTECTED] wrote: > > What do you mean? Can you specify which special functions you don't > > see? > > I get: > > py> class X: > >pass > > py> dir(X) > > ['__doc__', '__module__']How ab

Re: I want to see all the variables

2006-12-29 Thread Steven D'Aprano
On Fri, 29 Dec 2006 08:20:22 -0600, Larry Bates wrote: > johnf wrote: >> Hi, >> When I use dir() I don't see the __ underscore items. Is there anything >> that will show all the private vars and functions? >> >> johnf > > The idea of the underscore items is that they aren't to be used by > you.

Re: I want to see all the variables

2006-12-29 Thread Steven D'Aprano
On Fri, 29 Dec 2006 07:57:30 -0800, [EMAIL PROTECTED] wrote: > What do you mean? Can you specify which special functions you don't > see? > I get: > py> class X: > pass > py> dir(X) > ['__doc__', '__module__'] How about these? >>> X.__dict__ {'__module__': '__main__', '__doc__': None} >>>

Re: I want to see all the variables

2006-12-29 Thread [EMAIL PROTECTED]
What do you mean? Can you specify which special functions you don't see? I get: py> class X: pass py> dir(X) ['__doc__', '__module__'] py> class X: def __getitem__(self, x): pass py> dir(X) ['__doc__', '__getitem__', '__module__'] On Dec 29, 12:35 pm, johnf <[EMAI

Re: I want to see all the variables

2006-12-29 Thread Larry Bates
johnf wrote: > Hi, > When I use dir() I don't see the __ underscore items. Is there anything > that will show all the private vars and functions? > > johnf The idea of the underscore items is that they aren't to be used by you. If you wish to access private variables and functions you will almo

I want to see all the variables

2006-12-29 Thread johnf
Hi, When I use dir() I don't see the __ underscore items. Is there anything that will show all the private vars and functions? johnf -- http://mail.python.org/mailman/listinfo/python-list