predicting function calls?
Roy Smith
roy at panix.com
Wed Dec 28 09:21:58 EST 2005
Steven D'Aprano <steve at REMOVETHIScyber.com.au> wrote:
> How do you decide whether handle.foo should be treated as an attribute or
> an operation?
That's exactly what I'm trying to figure out. In the legacy system I'm
trying to emulate, the interpreter knows the from syntax (i.e. whether
handle.foo is followed by an open paren or not). I'm looking for some way
I can emulate that behavior in Python.
>
> If your object has an attribute foo, then what should you do when somebody
> calls handle.foo()? That is, they treat an attribute as if it were an
> operation? And vice versa.
That's easy. In such a case, the database will generate an error, which I
can then pass on to the user, probably by raising some subclass of
TypeError.
More information about the Python-list
mailing list