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
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
> > 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
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
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
> 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
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
>
> 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):
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
>
> 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
[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
11 matches
Mail list logo