[Zope3-dev] Proxy and __slots__
Garrett Smith
garrett at mojave-corp.com
Mon Aug 29 11:45:00 EDT 2005
I ended up using 'type' to create a new proxy with a dynamically created __slots__. I haven't run into any weirdness with that approach, so far :)
-- Garrett
> -----Original Message-----
> From: Jim Fulton [mailto:jim at zope.com]
> Sent: Monday, August 29, 2005 9:03 AM
> To: Garrett Smith
> Cc: 'zope3-dev at zope.org'
> Subject: Re: [Zope3-dev] Proxy and __slots__
>
> Garrett Smith wrote:
> > I'd like to create a proxy where __slots__ is determined
> (or appended to) when the proxy is constructed. E.g.
> >
> >
> >>>>foo = Foo()
> >>>>bar = SomeProxy(foo, 'baz')
> >>>>bar.baz = 123
> >>>>hasattr(foo, 'baz')
> >
> > False
> >
> >>>>hasattr(bar, 'baz')
> >
> > True
> >
> > Is it possible to do this?
>
> No, at least not using the standard __slot__ mechanism.
>
> Jim
>
> --
> Jim Fulton mailto:jim at zope.com Python Powered!
> CTO (540) 361-1714 http://www.python.org
> Zope Corporation http://www.zope.com http://www.zope.org
>
More information about the Zope3-dev
mailing list