Using '__mul__' within a class

John J. Lee jjl at
Sun Sep 25 16:28:07 CEST 2005

"Gerard Flanagan" <grflanagan at> writes:
> class FibonacciMatrix:
>     def Copy( self ):

__copy__ would be a more standard name.  Then:

import copy
fm = FibonacciMatrix()
fm2 = copy.copy(fm)

I suppose you could also add:

__deepcopy__ = __copy__

in the body of the class definition.


More information about the Python-list mailing list