A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/033465.html below:

[Python-Dev] CALL_ATTR, A Method Proposal

[Python-Dev] CALL_ATTR, A Method Proposal [Python-Dev] CALL_ATTR, A Method ProposalFinn Bock bckfnn@worldonline.dk
Mon, 17 Feb 2003 09:04:14 +0100
[Guido van Rossum]

 > Here's how I think the CALL_ATTR opcode should work:

Which is basicly what Jython does (except that jython does
not yet have new-style classes).

Jython also does a tiny bit of handling of non-functions.
Maybe that is usefull here too.

  >     if <obj> is a new instance:
  >        if the class's getattr policy is standard:
  >           if <name> not in <obj>.__dict__:
  >              search <obj>.__class__ and its base classes for <name>
  >              if found and the result is a Python function:
  >                  call it with arguments (<obj>, <args>) and return
  >     elif <obj> is a classic instance:
  >        if <name> not in <obj>.__dict__:
  >           search <obj>.__class__ and its base classes for <name>
  >           if found:
                   if the result is a Python function:
                       call it with arguments (<obj>, <args>) and return
                   else:
                       bind the non-function and call with (<args>)
  >     # if we get here, the optimization doesn't apply
  >     tmp = getattr(<obj>, <name>)
  >     return tmp(<args>)

regards,
finn






RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4