[Fwd: Re: managed lists?]

Jorgen Bodde jorgen.maillist at gmail.com
Tue May 22 03:13:38 EDT 2007


Hi,

Thanks. I agree that it is only 'me' that is the one doing it wrong.
But consider this scenario:

- Somewhere in my app I add a wrong type to an open regular list
- The app continues like it should
- After a (long) while I need to perform some search on the list, or whatever
- Exception occurs

It makes it hard to test this way. For example I can do something to
that list and not know about it much later .. If it blows up in my
face, I can fix it, but when that error hinders people who are using
my application, it is much worse.

With a somewhat managed list (forget about the types then, it was only
meant for my own satisfaction I guess), the access violation always
occurs on adding elements, which is always the path that a user
creates something 'new'. And if something new gets not added
correctly, I know where to look..

Anyway, I was looking for such a list class but i do understand that
most of the resposobility is for the programmer anyways and people
interacting with it. I did however need this solution so that I can
also add a better support for my database objects, add generic find
routines to that list class etc. So I basically added the interface
methods needed to let it be treated like a general list, like the
iterator, get method and what else. I was surprised it was so easy to
be done.

Python is cool when it comes to the "interface specification" v.s.
"class specification" it opens a lot of doors to paradigms otherwise
hard to implement, and I like the fact that every object can be
"adapted" to mimic another object needed by an internal routine in
Python, very-very dynamic indeed.

But being a strong typed C++ guy once, it takes some getting used to ;-)

Regards,
- Jorgen



More information about the Python-list mailing list