method = Klass.othermethod considered PITA

Jeff Epler jepler at
Sun Jun 5 01:35:43 CEST 2005

On Sat, Jun 04, 2005 at 10:43:39PM +0000, John J. Lee wrote:
> 1. In derived classes, inheritance doesn't work right:

Did you expect it to print 'moo'?  I'd have been surprised, and expected
the behavior you got.

> 2. At least in 2.3 (and 2.4, AFAIK), you can't pickle classes that do
>    this.

In all the versions of Python I've used, classes are pickled by name.
This example you wrote doesn't pose any special problem when pickling.

>>> pickle.dumps(A)
>>> pickle.dumps(B)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list