[Zope-dev] Waaagh! Python Script won't allow __setitem__

Evan Simpson evan@4-am.com
Mon, 19 Feb 2001 12:10:15 -0500


From: Chris Withers <chrisw@nipltd.com>
> I've got an object which implements __setitem__ in such a way that it's
> perfectly safe for use in Python Scripts. Sadly, it seems that Evan's Byte
Code
> hacks won't let me do this :-(

The only way that the security code can know that your __setitem__ is safe
is to rename (or alias) it to __guarded_setitem__.  Ditto for other such
methods.

> If I try and do:
>
> if type(x) == type(0):

Use the Script builtin "same_type" instead:

if same_type(x, 0):
    # Whatever

Cheers,

Evan @ digicool & 4-am