From: Curtis Maloney <[EMAIL PROTECTED]>
> What I want to know is, why can't Python Methods refer to anything not
> explicitly passed to them?  I don't want to have to make everything that
> invokes the method have to know to pass it half a dozen objects.
> Isn't the idea of a method to be executed in the namespace of it's parent?
> want my method to be able to access objects in it's own folder...

Yep.  You just need to make the first parameter of your method 'self', and
not have any parameters with default values.  For example, method plusX::

  <params>self, x</params>
  return len(self.objectIds()) + x

...can be called like 'folder.plusX(3)'.  You can also acquire objects that
your method needs from 'self'.


Evan @ digicool & 4-am

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to