Items inheriting attributes from its container?

Jan Kaliszewski zuo at chopin.edu.pl
Sun Aug 23 03:08:37 CEST 2009


PS. Erratum:

>    class Team(list):
>        """A container for Player() instances."""
>
>        def __init__(self, teamdata, playerdata=None):

*** Here should be added: list.__init__(self) ***

>            for key in teamdata:
>                setattr(self, key, teamdata[key])
>            for data in playerdata:
>                self.append(Player(data))

-- 
Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>



More information about the Python-list mailing list