Re: Customizing class attribute access in classic classes

2011-10-30 Thread Geoff Bache
Thanks for this Steven. I'm however gettings some pretty odd effects, both on method access and inheritance. I expanded your example a bit... class Meta: def __init__(self, name, bases, namespace): self.__name__ = name self.__bases__ = bases self.__dict__ = namespace

Re: Customizing class attribute access in classic classes

2011-10-30 Thread Steven D'Aprano
On Sat, 29 Oct 2011 14:06:12 -0700, Geoff Bache wrote: > Hi, > > I'm wondering if there is any way to customize class attribute access on > classic classes? > > So this works: > > class Meta(type): > def __getattr__(cls, name): > return "Customized " + name > > class A: > __met

Re: Customizing class attribute access in classic classes

2011-10-30 Thread Geoff Bache
On Oct 30, 4:16 am, Ben Finney wrote: > Geoff Bache writes: > > I'm wondering if there is any way to customize class attribute access > > on classic classes? > > Why do that? What is it you're hoping to achieve, and why limit it to > classic classes only? > I'm building a mocking tool, CaptureMo

Re: Customizing class attribute access in classic classes

2011-10-29 Thread Ben Finney
Geoff Bache writes: > I'm wondering if there is any way to customize class attribute access > on classic classes? Why do that? What is it you're hoping to achieve, and why limit it to classic classes only? > So this works: > > class Meta(type): > def __getattr__(cls, name): > return