> > single instance (or indeed no instances because you could
> > use a static method... or get really fancy and create a
> > meta-class!).
>
> or make it a static method of Building
Yes that's actually what I meant, but reading it back it
sounds like I meant static Factory method Ho hum.
Ismael Garrido wrote:
But there's something that I couldn't understand. In the following code,
my guess would be that "I'm back from the death" would never get
printed... but it is... and twice! Why?
It's printed every time B.pong() is called, just as "Pong" is. You print
each one twice - no mys
Alan Gauld wrote:
Absolutely, looks like you answered your own question... :-)
But if you want an OOP approach thre are some things to try.
First you can create a BuildingFactory class that has a
single instance (or indeed no instances because you could
use a static method... or get really fancy an
Alan Gauld wrote:
But if you want an OOP approach thre are some things to try.
First you can create a BuildingFactory class that has a
single instance (or indeed no instances because you could
use a static method... or get really fancy and create a
meta-class!).
or make it a static method of Build
> Are you referring to a Python object? If so you may assign a class
to the
> object's __class__ attribute.
> class A:pass
> class B:pass
> b = b()
> print b.__class__ # displays
> b.__class__ = A
> print b.__class__ # displays
Interesting Bob, but presumably that doesn't change the internal
sta
> > let itself load. Now, with subclasses, if I send the House XML to
> > Building I get a Building instance, when I need a House instance.
>
> You can't make an object transform into an object of a different
> class. You need to identify what class the object will be an
instance
> of before loadin
At 10:30 AM 3/24/2005, Max Noel wrote:
On Mar 24, 2005, at 18:07,
Ismael Garrido wrote:
Hello.
I have a program that saves/loads to/from XML. I have a main class
Building, and a subclass House(Building). When I save the code I instruct
each object to save itself to XML (using ElementTree), so Hou
Max Noel wrote:
On Mar 24, 2005, at 18:07, Ismael Garrido wrote:
Hello.
I have a program that saves/loads to/from XML. I have a main class
Building, and a subclass House(Building). When I save the code I
instruct each object to save itself to XML (using ElementTree), so
House adds itself to the
On Mar 24, 2005, at 18:07, Ismael Garrido wrote:
Hello.
I have a program that saves/loads to/from XML. I have a main class
Building, and a subclass House(Building). When I save the code I
instruct each object to save itself to XML (using ElementTree), so
House adds itself to the XML tree.
My pro
Hello.
I have a program that saves/loads to/from XML. I have a main class
Building, and a subclass House(Building). When I save the code I
instruct each object to save itself to XML (using ElementTree), so House
adds itself to the XML tree.
My problem is when I load the XML. Before having subcla
10 matches
Mail list logo