In article ,
Tim Chase wrote:
>On 08/18/10 21:47, Steven D'Aprano wrote:
>>
>> Frankly, I think the OP doesn't really know what he wants, other than
>> premature optimization. It's amazing how popular that is :)
>
>You see, the trick to prematurely optimizing is to have a good
>algorithm for pre
On 08/18/10 21:47, Steven D'Aprano wrote:
Frankly, I think the OP doesn't really know what he wants, other than
premature optimization. It's amazing how popular that is :)
You see, the trick to prematurely optimizing is to have a good
algorithm for prematurely optimizing...the real question th
On Wed, 18 Aug 2010 16:03:58 +0200, Frederic Rentsch wrote:
> On Mon, 2010-08-16 at 23:17 +, Steven D'Aprano wrote:
>> On Mon, 16 Aug 2010 20:40:52 +0200, Frederic Rentsch wrote:
>>
>> > How about
>> >
>> [obj for obj in dataList if obj.number == 100]
>> >
>> > That should create a lis
On Mon, 2010-08-16 at 23:17 +, Steven D'Aprano wrote:
> On Mon, 16 Aug 2010 20:40:52 +0200, Frederic Rentsch wrote:
>
> > How about
> >
> [obj for obj in dataList if obj.number == 100]
> >
> > That should create a list of all objects whose .number is 100. No need
> > to cycle through a
On Mon, 16 Aug 2010 20:40:52 +0200, Frederic Rentsch wrote:
> How about
>
[obj for obj in dataList if obj.number == 100]
>
> That should create a list of all objects whose .number is 100. No need
> to cycle through a loop.
What do you think the list comprehension does, if not cycle throug
On Sun, 2010-08-15 at 15:14 +0200, Peter Otten wrote:
> ChrisChia wrote:
>
> > dataList = [a, b, c, ...]
> > where a, b, c are objects of a Class X.
> > In Class X, it contains self.name and self.number
> >
> > If i wish to test whether a number (let's say 100) appears in one of
> > the object, a
On Sun, 15 Aug 2010 05:47:04 -0700, ChrisChia wrote:
> dataList = [a, b, c, ...]
> where a, b, c are objects of a Class X. In Class X, it contains
> self.name and self.number
>
> If i wish to test whether a number (let's say 100) appears in one of the
> object, and return that object,
> is that o
ChrisChia wrote:
dataList = [a, b, c, ...]
where a, b, c are objects of a Class X.
In Class X, it contains self.name and self.number
If i wish to test whether a number (let's say 100) appears in one of
the object, and return that object,
is that only fast way of solving this problem without iter
ChrisChia wrote:
> dataList = [a, b, c, ...]
> where a, b, c are objects of a Class X.
> In Class X, it contains self.name and self.number
>
> If i wish to test whether a number (let's say 100) appears in one of
> the object, and return that object,
> is that only fast way of solving this problem