Re: Set & Frozenset?

2009-03-11 Thread Lie Ryan
R. David Murray wrote: Lie Ryan wrote: Matt Nordhoff wrote: Alan G Isaac wrote: Hans Larsen schrieb: How could I "take" an elemment from a set or a frozenset On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: You iterate over them. If you only want one value, use iter(the_s

Re: Set & Frozenset?

2009-03-10 Thread R. David Murray
Lie Ryan wrote: > Matt Nordhoff wrote: > > Alan G Isaac wrote: > >>> Hans Larsen schrieb: > How could I "take" an elemment from a set or a frozenset > >> > >> On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: > >>> You iterate over them. If you only want one value, use > >>>

Re: Set & Frozenset?

2009-03-10 Thread Terry Reedy
Paul Rubin wrote: Terry Reedy writes: I'd never expect that for-loop assignment is even faster than a precreated iter object (the second test)... but I don't think this for-looping variable leaking behavior is guaranteed, isn't it? It is an intentional, documented feature: ... I prefer think

Re: Set & Frozenset?

2009-03-10 Thread Paul Rubin
Terry Reedy writes: > > I'd never expect that for-loop assignment is even faster than a > > precreated iter object (the second test)... but I don't think this > > for-looping variable leaking behavior is guaranteed, isn't it? > > It is an intentional, documented feature: ... I prefer thinking of

Re: Set & Frozenset?

2009-03-10 Thread Terry Reedy
Lie Ryan wrote: I recall a claim that for result in myset: break is the most efficient way to get one result. I'd never expect that for-loop assignment is even faster than a precreated iter object (the second test)... but I don't think this for-looping variable leaking behavior is guar

Re: Set & Frozenset?

2009-03-10 Thread Lie Ryan
Matt Nordhoff wrote: Alan G Isaac wrote: Hans Larsen schrieb: How could I "take" an elemment from a set or a frozenset On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: You iterate over them. If you only want one value, use iter(the_set).next() I recall a claim that f

Re: Set & Frozenset?

2009-03-09 Thread Matt Nordhoff
Alan G Isaac wrote: >> Hans Larsen schrieb: >>> How could I "take" an elemment from a set or a frozenset > > > On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: >> You iterate over them. If you only want one value, use >> iter(the_set).next() > > > I recall a claim that > >

Re: Set & Frozenset?

2009-03-09 Thread Alan G Isaac
Hans Larsen schrieb: How could I "take" an elemment from a set or a frozenset On 3/8/2009 2:06 PM Diez B. Roggisch apparently wrote: You iterate over them. If you only want one value, use iter(the_set).next() I recall a claim that for result in myset: break is the mos

Re: Set & Frozenset?

2009-03-08 Thread Tim Golden
Tim Golden wrote: Diez B. Roggisch wrote: Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice.

Re: Set & Frozenset?

2009-03-08 Thread Tim Golden
Diez B. Roggisch wrote: Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice. From a dict: by k

Re: Set & Frozenset?

2009-03-08 Thread Diez B. Roggisch
Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice. From a dict: by key. But