bruno at modulix wrote: > [EMAIL PROTECTED] wrote: > (meta : please don't top-post) > > Intuitively, the name lookup on > > self.parent.foo would be faster than if you passed in the object in > > question > > > Each dot means doing a lookup in a namespace. The more dots, the more > lookups. And lookups do have a cost. hmm, intuition may not be right in this case. Lookups do have a cost - now I"m almost tempted to write and run a test for this - but the cost of each lookup is also relative to the current scope. I haven't looked over the implementation of the python interpreter - but I would hope the lookup on self would be optimized and trivial. The next relevant question would be is it cheaper to lookup self.parent or to look up a method variable, which I supsect would depend on the number of names in self vs. number of names in the method.
> > -- > bruno desthuilliers > python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for > p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list