On Thursday 05 June 2008, Shane Hathaway wrote: > Are you in fact using RestrictedPython? The code snippet looks like it > only uses a security proxy. RestrictedPython is a custom Python > compiler; you're not using it unless your interactive Python prompt uses > RestrictedPython to compile all expressions.
You are right. > The behavior you saw is exactly what happens when an object implements > __getitem__ and __len__ but not __getslice__. If lp matches that > description, and the length of lp is 2, then Python evaluates "lp[-3:]" > as "lp.__getitem__(slice(-1, 2147483647, None))". I wish Python would > instead evaluate it as "lp.__getitem__(slice(-3))", but maybe there are > historical reasons for this. But this is still fine. the first index I got for "lp" is +1, not -1. I have tried to ready through the C code of Proxy. It clearly exposes __getslice__. See zope/proxy/_zope_proxy_proxy.c, line 630 and 746. Does anyone else have an idea? Regards, Stephan -- Stephan Richter Web Software Design, Development and Training Google me. "Zope Stephan Richter" _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org 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 )