[Fwd: Re: managed lists?]

Jorgen Bodde jorgen.maillist at gmail.com
Mon May 21 17:49:12 EDT 2007


Hi Bruno,

Thanks for your answer.

Well what I am after is a list of relations to some class type. And in
that list I do not wish to have accidentally put ints, strings, only
one type of object, or interface. Now I can make the list interface
safe, but it is only meant for relational purposes only. So to
illustrate:

Song <>---->> Tab
Song <>--->> Tuning

I want a "tabs" collection only consisting of Tab objects. They are
very specific so "mimicing" a tab interface is not something that will
be done anytime soon.

I'm a traditional C++ programmer, and maybe I go through some
transitional phase I don't know but exposing my list as read /
(over)write property to the "outside world" being the rest of my
object model, is just asking for problems. So this "strong" typed list
will ensure me at "add" time the exception occurs, rather then
somewhere in my applciation who knows much later that something blows
up because the "object" from that list is retrieved and something
unpredictable goes wrong. Is that so weird to do? As I said earlier I
am a python newbie, I love the language, but the fact it can blow up
at unpredictable times, gives me shivers.

> Everything in Python is an object. Including integers. And there's no
> 'char' type in Python.

The array type by the way says in the API that it can be constructed
with a simple type like a char as in a "c" type, an int as in a "i"
type etc..

See here:

http://www.python.org/doc/1.5.2p2/lib/module-array.html

So what I understand it's purpose is creating a buffer of some kind of
a fixed type to maybe communicate with other DLL's or objects that
require such a thing.

As I said, I might be going through a transitional phase, but exposing
my relation list as simply a list class where all kinds of objects can
be dumped in, seems too much for me at this point ;-)

Thanks,
- Jorgen



More information about the Python-list mailing list