Re: [Zope-dev] _getOb or __getattr__?

2001-03-12 Thread Toby Dickenson
On Wed, 07 Mar 2001 09:49:09 -0500, Shane Hathaway [EMAIL PROTECTED] wrote: Invoking C from Python is fast, but invoking Python from C apparently requires a lot of work. Invoking a python function from anywhere (even from another python function) requires alot of work. Toby Dickenson [EMAIL

Re: [Zope-dev] _getOb or __getattr__?

2001-03-07 Thread Chris Withers
subobjects because acquisition only looks at object attributes. It doesn't know anything about _getOb(). (And it's not a good idea to teach it to use _getOb(); think what it would be like if a Xeon ran like a 386...) I remember the days when... ;-) Seriously though, why would that make it

Re: [Zope-dev] _getOb or __getattr__?

2001-03-07 Thread Shane Hathaway
Chris Withers wrote: subobjects because acquisition only looks at object attributes. It doesn't know anything about _getOb(). (And it's not a good idea to teach it to use _getOb(); think what it would be like if a Xeon ran like a 386...) I remember the days when... ;-) Seriously

Re: [Zope-dev] _getOb or __getattr__?

2001-03-07 Thread Chris Withers
Shane Hathaway wrote: No. The expensive part is invoking Python code from C. It's the same problem described by the documentation for the Python sort() method: it's much faster to sort() then reverse() than it is to sort() with a comparison function that reverses the elements. Invoking C

[Zope-dev] _getOb or __getattr__?

2001-02-27 Thread Chris Withers
Hi, I need a product with custom attribute getting code and so looked to the BTreeFolder product for inspiration. It implements both __getattr__ and _getOb which appear to do roughly the same thing. What's the difference? Shane hints that __getattr__ is slower but allows acquisiton. Why is

Re: [Zope-dev] _getOb or __getattr__?

2001-02-27 Thread Chris Withers
Jeffrey P Shell wrote: _getOb and _setOb are for placing subobjects somewhere besides attributes (which is the default implementation). When would __getattr__ be used then? cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED]

Re: [Zope-dev] _getOb or __getattr__?

2001-02-27 Thread Chris Withers
Jeffrey P Shell wrote: _getOb and _setOb are for placing subobjects somewhere besides attributes (which is the default implementation). _getOb and friends are the default protocol that *SHOULD* be used by systems that change subobjects (ie - copy and paste). Sorry, just thought of

Re: [Zope-dev] _getOb or __getattr__?

2001-02-27 Thread Jeffrey P Shell
"Chris Withers" [EMAIL PROTECTED] wrote: Jeffrey P Shell wrote: _getOb and _setOb are for placing subobjects somewhere besides attributes (which is the default implementation). When would __getattr__ be used then? In what context? You could wire __getattr__ to call into _getOb (and

Re: [Zope-dev] _getOb or __getattr__?

2001-02-27 Thread Chris McDonough
Sorry, just thought of another coupla questions: If x is an instance of my class, then: If I do x.a = 1, is _setOb called? If I do print x.a, is _getOb called? No in either case. _setOb shouldn't be used directly in the current ObjectManger implementation. It doesn't populate the _objects

Re: [Zope-dev] _getOb or __getattr__?

2001-02-27 Thread Chris Withers
Chris McDonough wrote: Sorry, just thought of another coupla questions: If x is an instance of my class, then: If I do x.a = 1, is _setOb called? If I do print x.a, is _getOb called? No in either case. _setOb shouldn't be used directly in the current ObjectManger

Re: [Zope-dev] _getOb or __getattr__?

2001-02-27 Thread Shane Hathaway
Chris Withers wrote: Hi, I need a product with custom attribute getting code and so looked to the BTreeFolder product for inspiration. It implements both __getattr__ and _getOb which appear to do roughly the same thing. What's the difference? _getOb() is part of the ObjectManager