In article mailman.2294.1282187962.1673.python-l...@python.org,
Tim Chase python.l...@tim.thechases.com 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,
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 loop.
What
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 list of all objects whose
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
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, and return
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 through a
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 iterating
through
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
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
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 only
10 matches
Mail list logo