[Zope] Re: _allowed_meta_types

Dylan Reinhardt zope at dylanreinhardt.com
Thu Oct 9 04:35:11 EDT 2003


On Thu, 2003-10-09 at 00:27, Richard Jennings wrote:
> Now what worries me is the construct:
> 	'if meta_type['name'] in self.selected_meta_types:'
> if self.selected_meta_types was a dictionary, I could understand it but it isn't, its
> a list.  This should cause a 'not integer' error.  There is something here I haven't
> grasped and I'm probably being dumb, so please enlighten me.

Historically, the "in" construct *only* works when the right hand
argument is a sequence.  In Python 2.1 (the version officially supported
through Zope 2.6) in will *not* work on a dictionary.  Try it.

You may be using a more recent version of Python for other projects. 
Come Zope 2.7, you'll be able to put those techniques to good use.  :-)

HTH,

Dylan





More information about the Zope mailing list