Re: [Fwd: Re: managed lists?]

2007-05-24 Thread Jorgen Bodde
@ Larry, As much as I like to follow the idiom that Python has, I do not see the usefulness of making an add function that checks the interface that other objects might need. Besides the fact it is a bit overhead and not to mention performance draining, in an application that I develop myself, wit

Re: [Fwd: Re: managed lists?]

2007-05-22 Thread Bruno Desthuilliers
Jorgen Bodde a écrit : (snip) > class ObjListException(Exception): >pass > > class ObjListIterator(object): >def __init__(self, objlist): >self.__objlist = objlist >self.__idx = 0 You should use a single underscore here. -- http://mail.python.org/mailman/listinfo/python

Re: [Fwd: Re: managed lists?]

2007-05-22 Thread Bruno Desthuilliers
Jorgen Bodde a écrit : > 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, So don't do it !-) > only > one type of object, or interface. Now I can make the list inter

Re: [Fwd: Re: managed lists?]

2007-05-22 Thread Larry Bates
Jorgen Bodde wrote: > Hi Gabriel, > > Yep that basically covered my implementation as well. It was rather > trivial to make it, and even for a python newbie it was simple which > says enough about the language itself. ;-) > > Although I understand the opinions that you should not care about > typ

Re: [Fwd: Re: managed lists?]

2007-05-22 Thread Jorgen Bodde
Hi Gabriel, Yep that basically covered my implementation as well. It was rather trivial to make it, and even for a python newbie it was simple which says enough about the language itself. ;-) Although I understand the opinions that you should not care about types, I do believe putting a constrain

Re: [Fwd: Re: managed lists?]

2007-05-22 Thread Gabriel Genellina
En Tue, 22 May 2007 04:13:38 -0300, Jorgen Bodde <[EMAIL PROTECTED]> escribió: > 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

Re: [Fwd: Re: managed lists?]

2007-05-22 Thread Jorgen Bodde
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

Re: Types in Python (was: managed lists?)

2007-05-21 Thread Asun Friere
On May 22, 10:28 am, Ben Finney <[EMAIL PROTECTED]> wrote: > "Jorgen Bodde" <[EMAIL PROTECTED]> writes: > > 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 ob

Re: Types in Python (was: managed lists?)

2007-05-21 Thread Asun Friere
On May 22, 10:28 am, Ben Finney <[EMAIL PROTECTED]> wrote: > "Jorgen Bodde" <[EMAIL PROTECTED]> writes: > > 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 ob

Types in Python (was: managed lists?)

2007-05-21 Thread Ben Finney
"Jorgen Bodde" <[EMAIL PROTECTED]> writes: > I still have to get used to the lack of (strong) types, Python does not have weak types, it has strong types. An object knows its type, and the rules on coercion to other types are minimal and well-defined. Python does not have static typing, it has d

Re: [Fwd: Re: managed lists?]

2007-05-21 Thread Stargaming
Jorgen Bodde schrieb: > 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 o

Re: [Fwd: Re: managed lists?]

2007-05-21 Thread Jorgen Bodde
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

Re: [Fwd: Re: managed lists?]

2007-05-21 Thread Bruno Desthuilliers
(snip - I suppose I'm answering to Jorgen, but being another idiot myself I may be wrong... anyway:) > Thanks for the answer. I did make something myself after i could not > find anything, just because it was fun to do :-) I did saw array but > it was not for object, only for small types like int

[Fwd: Re: managed lists?]

2007-05-21 Thread Wildemar Wildenburger
I answered off list (because besically I'm an idiot). So if you like, read up the current news. :) Original Message Subject: Re: managed lists? Date: Mon, 21 May 2007 21:30:37 +0200 From: Jorgen Bodde <[EMAIL PROTECTED]> To: Wildemar Wildenbur

managed lists?

2007-05-21 Thread Jorgen Bodde
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 a