Is it correct this way to inherit from a list?

gialloporpora gialloporpora at gmail.com
Sat Mar 2 21:33:18 EST 2013


Risposta al messaggio di Ian Kelly :

> I retract that.  On further testing, it is actually the __init__
> method that initializes the list contents, not the __new__ method.  So
> this is all you need:
>
> class Vector(list):
>      def __init__(self, *args):
>          super(Vector, self).__init__(args)

Thanks, it works :-), it is simpler of my implementation, thank again.
Sandro


-- 
*gialloporpora: Il nuovo album degli Atoms for Peace (con Thom Yorke dei 
radiohead) disponibile live: http://t.co/3VgxNFrZ Un po' troppo 
elettronico per me * - http://bit.ly/ZmDCze
Sto ascoltando: *Pink Floyd – Us and Them * - http://bit.ly/ZmDC2m



More information about the Python-list mailing list