kishore wrote:
Hi Luigi Ballabio,

Thankyou very much for your reply,
it worked well.

It does work in most cases, but "getattr(self, methodName)" is generally to be preferred over "vars(self.__class__)[methodName]", as the latter does not use Python's standard attribute lookup scheme.


The semantics of the following two statements are basically identical:
  getattr(t, 'bar')()
  t.bar()

Using vars() directly, however, results in a slightly different lookup process that will *usually* give the same answer as above, but not always. It's that 'not always' which can end up hurting. . .

Regards,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to