promoting [] by superclass?

Robert Brewer fumanchu at amor.org
Tue Jun 8 12:49:35 EDT 2004


Jim Newton wrote:
> class Pair(list):
>    ...
> 
> how can i "cast",  "promote" [] to class Pair?

>>> class Pair(list): pass
... 
>>> p = Pair([])
>>> p
[]
>>> type(p)
<class '__main__.Pair'>

Or was there some other behavior you had in mind?


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list