[Zope] Finding an object in a folder

Florent Guillaume fg at nuxeo.com
Fri May 27 07:58:44 EDT 2005


Paul Winkler  <pw_lists at slinkp.com> wrote:
> On Fri, May 27, 2005 at 08:51:58AM +0100, Chris Withers wrote:
> > Paul Winkler wrote:
> > 
> > >marker = ()
> > >if getattr(some_object, marker) is not marker:
> > 
> > For good measure, I wonder if that should be a [], no a ()?
> 
> What's wrong with a tuple? There's no reason to mutate the marker. 

The whole point of a marker is that it is unique, so cannot be confused
with a legitimate value of the object examined.

And all empty tuples are equal.

In python 2.3, the idiom most commonly found is to use marker = object().

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope mailing list