tags:

views:

37

answers:

1

I would like to inherit from list to produce the myList class, that ony accepts one specific type of object (say ints). I am sure decorators can do that elegantly.

Thanks

+3  A: 

What about using arrays?

This module defines an object type which can compactly represent an array of basic values: characters, integers, floating point numbers. Arrays are sequence types and behave very much like lists, except that the type of objects stored in them is constrained. The type is specified at object creation time by using a type code, which is a single character. The following type codes are defined:

sberry2A
Mmmmm... Can an array store any type of object (instances of my own classes)?
NiKo