On Thu, Aug 20, 2009 at 06:56:11AM +0100, Piers Cawley wrote: > On Thu, Aug 20, 2009 at 4:40 AM, Jesse Luehrs<[email protected]> wrote: > > This failed because Child was being created and immutablized partway > > through the definition of Parent, and so Child's constructor (among > > other things) was incorrect (it didn't include attribute > > initialization code for the child attribute). This branch adds a > > warning whenever someone tries to call make_immutable on a class whose > > ancestor classes are not already immutable. There are a few caveats: > > I'm not familiar with the code, but would it be possible to remove the > warning and, instead attach some kind of memento to the parents' > metaclasses which will freeze the child class once the last parent has > become immutable?
Having the child class silently not become immutable in certain cases when you call make_immutable seems wrong, to me. How do you know the parent classes are ever actually going to be immutablized? > And that code's surely asking for trouble. Yeah, the code is definitely wrong, but a more helpful error message would be nice. -doy
