Dominic LoBue wrote: > As you suggested when I mentioned including __slots__, I went through > Urwid and added the __slots__ attribute where it made sense. > > Attached is a mercurial export of my changes. I've been using that > code all day today with my program and have worked out most of the > snags. The only problem I'm aware of is with the LineBox widget, I get > this error: > TypeError: Error when calling the metaclass bases > multiple bases have instance lay-out conflict > > I tried looking for a simple fix to get it working, but frankly it > made my brain hurt. >.< I finally gave in and just commented the > widget out since I wasn't using it anyway, and everything else worked. > Maybe you'll have an idea for a fix.
I'm unfamiliar with __slots__, but it looks like it would break any kind of multiple inheritance. It also would cause a problem any time you want to add an attribute that wasn't declared. What are the memory footprint gains you are seeing by using __slots__? How are you measuring them? I think they may only be appropriate for some classes, like the canvas classes, and things like AttrSpec that really only ever have a few attributes, and there is no need to subclass them. Ian _______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
