Re: checking if an object IS in a list

2008-07-21 Thread nicolas . pourcelot
On 20 juil, 07:17, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sat, 19 Jul 2008 13:13:40 -0700, nicolas.pourcelot wrote: On 18 juil, 17:52, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Fri, 18 Jul 2008 07:39:38 -0700, nicolas.pourcelot wrote: So, I use something like this

Re: checking if an object IS in a list

2008-07-20 Thread nicolas . pourcelot
(1) You are searching through lists to find float objects by identity, not by value -- http://mail.python.org/mailman/listinfo/python-list

Re: checking if an object IS in a list

2008-07-20 Thread nicolas . pourcelot
On 20 juil, 23:18, John Machin [EMAIL PROTECTED] wrote: On Jul 21, 4:33 am, [EMAIL PROTECTED] wrote: (1) You are searching through lists to find float objects by identity, not by value You wrote I used short lists (a list of 20 floats) and the element checked was not in the

Re: checking if an object IS in a list

2008-07-19 Thread nicolas . pourcelot
On 18 juil, 17:52, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Fri, 18 Jul 2008 07:39:38 -0700, nicolas.pourcelot wrote: So, I use something like this in 'sheet.objects.__setattr__(self, name, value)': if type(value) == Polygon:     for edge in value.edges:         if edge

checking if an object IS in a list

2008-07-18 Thread nicolas . pourcelot
Hi, I want to test if an object IS in a list (identity and not equality test). I can if course write something like this : test = False myobject = MyCustomClass(*args, **kw) for element in mylist: if element is myobject: test = True break and I can even write a isinlist(elt,

Re: checking if an object IS in a list

2008-07-18 Thread nicolas . pourcelot
On 18 juil, 11:30, Peter Otten [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi, I want to test if an object IS in a list (identity and not equality test). I can if course write something like this : test = False myobject = MyCustomClass(*args, **kw) for element in mylist:  

Re: checking if an object IS in a list

2008-07-18 Thread nicolas . pourcelot
In fact, 'any(myobject is element for element in mylist)' is 2 times slower than using a for loop, and 'id(myobject) in (id(element) for element in mylist)' is 2.4 times slower. -- http://mail.python.org/mailman/listinfo/python-list

Re: checking if an object IS in a list

2008-07-18 Thread nicolas . pourcelot
On 18 juil, 12:26, Peter Otten [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I think something like id(myobject) in (id(element) for element in mylist) would also work, also it's not so readable, and maybe not so fast (?)... An is in operator would be nice... And rarely used.

Re: checking if an object IS in a list

2008-07-18 Thread nicolas . pourcelot
On 18 juil, 13:13, Peter Otten [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: In fact, 'any(myobject is element for element in mylist)' is 2 times slower than using a for loop, and 'id(myobject) in (id(element) for element in mylist)' is 2.4 times slower. This is not a meaningful

Re: checking if an object IS in a list

2008-07-18 Thread nicolas . pourcelot
What is your (concrete) use case, by the way? I try to make it simple (there is almost 25000 lines of code...) I have a sheet with geometrical objects (points, lines, polygons, etc.) The sheet have an object manager. So, to simplify : sheet.objects.A = Point(0, 0) sheet.objects.B =

Re: wxpython and wxtextctrl

2005-05-19 Thread Nicolas Pourcelot
Ok, as I guessed, it was Boa installation which changed the wxpython version used. I removed Boa... Thanks ! Nicolas Greg Krohn a écrit : Nicolas Pourcelot wrote: Hello, my script worked well until today : when I tried to launch it, I got the following : frame = MyFrame(None,-1

wxpython and wxtextctrl

2005-05-18 Thread Nicolas Pourcelot
Hello, my script worked well until today : when I tried to launch it, I got the following : frame = MyFrame(None,-1,Geometrie,size=wx.Size(600,400)) File /home/nico/Desktop/wxGeometrie/version 0.73/geometrie.py, line 74, in __init__ self.commande.Bind(wx.EVT_CHAR, self.EvtChar)

exporting from Tkinter Canvas object in PNG

2005-01-11 Thread Nicolas Pourcelot
Hello, I'm new to this mailing list and quite to Pyhon too. I would like to know how to export the contain of the Canvas object (Tkinter) in a PNG file ? Thanks :) Nicolas Pourcelot -- http://mail.python.org/mailman/listinfo/python-list