[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Does anyone have a python implementation of A*?



Bob Ippolito wrote:
> I think the point of difference is that the for loops in list 
> comprehensions are more likely C for loops, like with the builtins (map, 
> reduce, zip, etc)

sadly not really. list comprehensions are the same speed as for loops.

	newlist = []
	for x in oldlist:
		newlist.append(abs(x))

results in nearly identical speed with the list comprehension:

	newlist = [abs(x) for x in oldlist]

of course, for simple problems like this, the map/filter/reduce family 
can run them a bit quicker:

	newlist = map(abs, oldlist)


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org