managed lists?

Jorgen Bodde jorgen.maillist at gmail.com
Mon May 21 13:26:52 EDT 2007


Hi all,

I have been slowly progressing with my application written in
wxPython. I love the freedom, speed and lack of the compiling run. I
still have to get used to the lack of (strong) types, and it sometimes
frustates me to no end that a wrongly given argument explodes
somewhere deep inside my application without giving any clue why it
blew up in the first place..

Right now i have a list in a class that I export as a member variable
to the outside world, it is a standard list (e.g. [] ) but I wish to
have a stronger type checking when adding objects, that only some
objects are allowed and others are not. It was quite easy to create
it, but I wonder if there is already a standard solution for lists
that carry only objects of a single type?

I solved it now, by using isinstance() and giving the class name as
argument to the list (thank god that everything in Python is an object
;-) ) where I check against when adding, but re-inventing the wheel is
silly ofcourse

- Jorgen



More information about the Python-list mailing list