> Python 2.x can add new methods to a user-defined class or instance or
> redefine existing methods. 

> In [6]: def sayFoo(self): print 'foo'
> 
> In [7]: Data.sayFoo = sayFoo
> 
> In [8]: d1.sayFoo()
> foo
> 

Now for some reason I was sure that didn't work. So sure I never even tried! 
(despite my comments in another thread about experimenting with 
the >>> prompt!)


> The introduction of Abstract Base Classes in Python 2.6 and 3.0 seems
> intended to remedy this, giving you a way to specify an interface in
> the language:

I only downloaded v 3 a week or so ago and just spotted the ABC 
reference last week. I haven't looked at it yet so it will be interesting 
to see if you can do that.

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to