On Sunday 19 June 2011 08:39:43 Alan Gauld wrote:
> "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,

Thank you!

Lisi

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to