← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #268089]: Concatenate a variable to another variable name

 

Question #268089 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/268089

    Status: Open => Answered

RaiMan proposed the following answer:
I do not understand the reason behind this.

this already does what you want:
anotherVar0 = x[0]

... but instead of doing this you just can use x[0] whenever you want to
use the contained object reference.

Be aware: Python is completely object oriented:
anotherVar0 = x[0]

only copies the reference to the content.
So if you change anotherVar0, the content of x[0] will reflect this change immediately.

--- anyway: if it ever makes some sense:
exec("anotherVar%s = x" % myCount)

will execute the created statement
anotherVar0 = x

if myCount is 0 in that moment.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.