Your code:
colours = [turtle.color("red")]
Will run the function turtle.color("red")
, and store the return value in the list.
This is exactly the same as doing:
colours = [None]
If you call colours[0]
you get the return value, not the function. Python has no idea if the None
ended up there through a function call, or if you just assigned it manually.
You only posted 2 lines of code, so I don't quite know what the context is here, but you may want to do something like:
colours = [lambda: turtle.color("red"), lambda: turtle.color("blue")]
What this does, is store a lamba (or 'anonymous function') in your list. This function is not executed. You will now get:
>>> colours[0]
<function <lambda> at 0x80089e710>
And you can execute this as many times as you want by appending parenthesis, like so: colours[0]()
This technique is known as 'currying' by the way.