Re: Circular Class Logic

2007-03-16 Thread greg
Paul McGuire wrote: > I always assumed that super, being added to > the language later, represented some form of improvement, but this may > not be 100% correct. It's not -- super is not a replacement for explicit inherited method calls. It does something different, and has different use cases. I

Re: Circular Class Logic

2007-03-15 Thread Paul McGuire
On Mar 15, 9:02 pm, [EMAIL PROTECTED] wrote: > > > How is that (using 'super') really different from this: > > class Disk(Folder): > def __init__(self,driveLetter): > Folder.Folder.__init__(self, driveLetter + ":/") > Google for "python super" - there is documentation on this, plus some inte

Re: Circular Class Logic

2007-03-15 Thread half . italian
> > How is that really different from this: > > > class Disk(Folder): > > def __init__(self,driveLetter): > > Folder.Folder.__init__(self.path) # ??? Being that Folder is the > > superclass? > > Where did self.path come from? Even though Folder is the superclass, > self.path doesn't exist u

Re: Circular Class Logic

2007-03-15 Thread Gabriel Genellina
En Thu, 15 Mar 2007 09:01:07 -0300, <[EMAIL PROTECTED]> escribió: > I got it to work, but I had to add a check to see if the class > variable had been set.. > class Foo: > baz = None > def __init__(self): > if Foo.baz == None: > Foo.baz = True > initBaz() This is a different

Re: Circular Class Logic

2007-03-15 Thread Paul McGuire
On Mar 15, 1:55 pm, [EMAIL PROTECTED] wrote: > > class Disk(Folder): > > def __init__(self,driveLetter): > > super(Disk,self).__init__(driveLetter+":/") > > What is going on there? Is it just explicitly calling the super's > init function? What is going on is that Disk is being initia

Re: Circular Class Logic

2007-03-15 Thread half . italian
> Just initialize Folder at module level - see below. > -- Paul > > class Disk(Folder): > def __init__(self,driveLetter): > super(Disk,self).__init__(driveLetter+":/") What is going on there? Is it just explicitly calling the super's init function? How is that really different from t

Re: Circular Class Logic

2007-03-15 Thread Paul McGuire
On Mar 15, 7:01 am, [EMAIL PROTECTED] wrote: > > Remove the line above > > and add this below: > > def initFoo(): > > import baz > > Foo.baz = baz.Baz() > > initFoo() > > I got it to work, but I had to add a check to see if the class > variable had been set.. > > def initBaz(): > import Baz >

Re: Circular Class Logic

2007-03-15 Thread half . italian
> Remove the line above > and add this below: > def initFoo(): > import baz > Foo.baz = baz.Baz() > initFoo() I got it to work, but I had to add a check to see if the class variable had been set.. def initBaz(): import Baz Foo.baz = Baz.Baz() class Foo: baz = None def __init__(self):

Re: Circular Class Logic

2007-03-14 Thread Gabriel Genellina
gmail.com> writes: > That's not exactly what I'm doing, but your comment still might help. > I actually want to include an instance of a subclass in it's > superclass like this: Move the initialization to another function. > > = foo.py = > # import Baz Remove the line above > > class

Re: Circular Class Logic

2007-03-14 Thread half . italian
> > That is, each of the classes want to inherit from the others. That's not exactly what I'm doing, but your comment still might help. I actually want to include an instance of a subclass in it's superclass like this: = foo.py = import Baz class Foo: baz = Baz.Baz() def

Re: Circular Class Logic

2007-03-14 Thread Ben Finney
[EMAIL PROTECTED] writes: > Short of making 'Disk' no longer a subclass of Folder, is there any > other way to include a subclassed instance in the base class of that > object? (this is very hard to put in to words) It's a little difficult to visualise what you're describing, but IIUC your proble

Circular Class Logic

2007-03-14 Thread half . italian
I have a set of classes that describe Files, Folders, etc., that I use often in my scripts for moving files around, getting a files extension, converting paths, changing permissions, etc It's very similar to Jason Orendorff's 'Path' library, and is very useful to me. The base class 'Data.py' stor