On Mon, Sep 17, 2012 at 11:11 PM, <sepa...@sibmail.com> wrote:

> Hello, Jeff Hardy ).
> 1)
> It is a good reference. But the methods must be defined in advance (class
> A). If I write ttt ('i') without defining it in the class A, I get an
> error. Use __getattr__ in class A does not work.
>
> class A(object):
>     def salutation(self, accusative):
>         # code
>
>     def farewell(self, greeting, accusative):
>         # code
> ......................
>
> salutation("world")
> farewell("goodbye", "world")
> ttt('yy')
> name 'ttt' is not defined.
>
> Correct.
Python is telling you that 'ttt' has no meaning.
It does not, cannot, will never, do anything else.
This is an error in your program.
You must do something -- either a 'def', an assignment, or an include, to
define 'ttt' before you use it.
__getattr__() is used to catch undefined references from code in a
_different_ module, not your own.
Why would you go to the trouble of writing code in your own program to fix
errors in itself?
--
Vernon
_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to