[Tutor] subclass of list

Bob Gailer ramrom@earthling.net
Fri Jan 3 17:40:34 2003


--=======1596208D=======
Content-Type: text/plain; x-avg-checked=avg-ok-1CF2B71; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit

In the latest Python one can subclass types, such as list.
What is the benefit? What can one do with an instance of a subclass of list?
I'd like to think that, given:

class MyList(list):
   def __init__(self, list)
     self.list = list
x = MyList([3,4])

x[0] would then return 3?

Bob Gailer
mailto:ramrom@earthling.net
303 442 2625

--=======1596208D=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-1CF2B71
Content-Disposition: inline


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/2002

--=======1596208D=======--