"Lisi" <lisi.re...@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/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor