On 29 Jan., 19:22, William Pursell [EMAIL PROTECTED] wrote:
I
believe per object mixin is the correct
term for such an animal. The first several google
hits on that phrase all reference xotcl, so I'm
not sure if that is an xotcl inspired vocabulary
that isn't really standard.
well, it
On Jan 24, 9:16 pm, Guilherme Polo [EMAIL PROTECTED] wrote:
2008/1/24, William Pursell [EMAIL PROTECTED]:
referring to changing an objects class
Can I do it in Python?
class A(object): pass
class B(object): pass
a = A()
a.__class__ = B
That ? Maybe you meant something else.
That is
En Tue, 29 Jan 2008 16:22:24 -0200, William Pursell
[EMAIL PROTECTED] escribi�:
I'm fairly excited at the idea of being able to
do per-object mixins in xotcl. I guess it would
look like this in python:
BROKEN CODE:
a = object()
a.__class__.append( foo )
a.__class__.append( bar )
In
Steven D'Aprano a écrit :
On Thu, 24 Jan 2008 12:35:44 -0800, William Pursell wrote:
The ability to have an object change class is
certainly (to me) a novel idea. Can I do it in Python?
Yes, mostly. Example:
(snip)
If you actually play around with this, you'll soon find the
I've been away from Python for at least a year, and in the interim
have spent a little time looking at the XOTcl object framework for
Tcl. One of the interesting features of XOTcl is the ability for an
object to change class dynamically. The XOtcl documentation makes the
claim that this makes
On Jan 24, 12:35 pm, William Pursell [EMAIL PROTECTED] wrote:
I'm not sure that describes the method well. Basically, you can
instantiate an object A of class Foo, and later change A to be an
object of class Bar. Does Python support this type of flexibility?
As I stated above, I've been
2008/1/24, William Pursell [EMAIL PROTECTED]:
I've been away from Python for at least a year, and in the interim
have spent a little time looking at the XOTcl object framework for
Tcl. One of the interesting features of XOTcl is the ability for an
object to change class dynamically. The
On Thu, 24 Jan 2008 12:35:44 -0800, William Pursell wrote:
Basically, you can
instantiate an object A of class Foo, and later change A to be an object
of class Bar. Does Python support this type of flexibility? As I
stated above, I've been away from Python for awhile now, and am a bit