Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24814

Re: Dictless classes

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: Dictless classes
Date 2012-07-03 08:28 -0400
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-3F5730.08280003072012@news.panix.com> (permalink)
References <4ff27d28$0$11103$c3e8da3@news.astraweb.com> <XnsA0856B054AB3Fduncanbooth@127.0.0.1>

Show all headers | View raw


In article <XnsA0856B054AB3Fduncanbooth@127.0.0.1>,
 Duncan Booth <duncan.booth@invalid.invalid> wrote:

> Also you cannot create a subclass of 'type' with non-empty slots (it throws 
> a type error "nonempty __slots__ not supported for subtype of 'type'"). 
> However I don't think that's really relevant as even if they did allow you 
> to use __slots__ it wouldn't prevent the creation of a __dict__ for the 
> 'type' base class.

I played around a bit trying to write a metaclass which implemented:

def __getattribute__(self, name):
   if name == "__dict__":
      raise AttributeError

but didn't get very far.  Maybe somebody with stronger metaclass-fu than 
I have could run with this idea?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Dictless classes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-03 05:03 +0000
  Re: Dictless classes alex23 <wuwei23@gmail.com> - 2012-07-02 22:50 -0700
  Re: Dictless classes Duncan Booth <duncan.booth@invalid.invalid> - 2012-07-03 09:38 +0000
    Re: Dictless classes Roy Smith <roy@panix.com> - 2012-07-03 08:28 -0400
  Re: Dictless classes Terry Reedy <tjreedy@udel.edu> - 2012-07-03 19:25 -0400

csiph-web