mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
more efficient replace
This commit is contained in:
parent
6c31d3a9cf
commit
bb9e38286d
@ -374,10 +374,11 @@ def replace(list, old, new, all=0):
|
|||||||
list[i] = new
|
list[i] = new
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
numReplaced = list.count(old)
|
numReplaced = 0
|
||||||
for i in xrange(numReplaced):
|
for i in xrange(len(list)):
|
||||||
ind = list.index(old)
|
if list[i] == old:
|
||||||
list[ind] = new
|
numReplaced += 1
|
||||||
|
list[i] = new
|
||||||
return numReplaced
|
return numReplaced
|
||||||
|
|
||||||
def reduceAngle(deg):
|
def reduceAngle(deg):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user