On Wed, Jul 30, 2003 at 12:19:35PM -0500, Evan Simpson wrote: > Paul Winkler wrote: > >you don't :) > >it's a convenience (less stuff to type if you access the object a lot) > >and/or an optimization (getSomeObject might be expensive). > > I believe that his example referred to the case where the intermediate > object must be called before path traversal can continue.
ah, i see. hm, well if getSomeObject is a Python Script, it's called anyway and it can only deal with someAttribute in its traverse_subpath anyway. > >Hm. Doesn't really matter - ObjectManager makes them equivalent > >anyway (except that some keys cannot be spelled as attributes, > >e.g. foo['bar.html']). > > Not quite. Attribute access invokes acquisition, while item access > never does, so getattr(foo, 'bar.html') may succeed where > foo['bar.html'] fails. Ugh. I don't know how I've been using zope 2 this long without noticing that item access doesn't acquire. But i just checked and by golly, you're right. I have to say, that's pretty horrible. :-) Is that documented anywhere? I've never seen it if so. And getattr(foo, "some.string.that's.not.a.valid.python.varname") is just aesthetically bad. :-\ yay zope 2... "principle of most surprise" wins again :-( -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's OVERLY PADDLE SADIST! (random hero from isometric.spaceninja.com) _______________________________________________ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
