[Tutor] Closing triple quotation marks.
Alan Gauld
alan.gauld at btinternet.com
Sun Jun 19 09:39:43 CEST 2011
"Lisi" <lisi.reisz at gmail.com> wrote
> It does indeed. Thank you, both of you. I have clearly not got the
> terms
> command, method, function (and feature?) clearly sorted out in my
> mind, so
> that is obviously where I need to go. I am supposed to be
> researching
> import, but I have not yet succeeded in seeing why it is a problem.
> So I'll
> switch to looking up method, function etc.
Add "callable" to your list of search terms.
Python has the concept of "callable objects" and
you can call a callable by using parentheses.
You can also test whether an object is callable
or not:
for obj in list_of_objects:
if callable(obj):
print obj() # call obj first
else:
print obj # just use the obj value
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list