The same!

Yesterday I had this code in hand:

for aSprite in spritesList:
    for aScript in aSprite.scripts:
        #if 'createCloneOf' in aScript:
        try:
            if aScript[aScript.index('createCloneOf')+1] ==  '_myself_':
                aSprite.clonesItSelf = True
        except ValueError:
            pass #script does not have clones
        if 'procDef' in aScript:
            aSprite.hasProcess = True
        if aSprite.hasProcess and aSprite.clonesItSelf:
            projectHasInterestingSprite = True
            break

So I was thinking where these three lines should go maybe they should be in the sprite loop not in the script loop.

for aSprite in spritesList:
    for aScript in aSprite.scripts:
        #if 'createCloneOf' in aScript:
        try:
            if aScript[aScript.index('createCloneOf')+1] ==  '_myself_':
                aSprite.clonesItSelf = True
        except ValueError:
            pass #script does not have clones
        if 'procDef' in aScript:
            aSprite.hasProcess = True
    if aSprite.hasProcess and aSprite.clonesItSelf:
        projectHasInterestingSprite = True
        break

But it is actually the same! That doesn’t happen often, usually these things matter!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s