Automatic reloading, metaclasses, and pickle
andrewfelch at gmail.com
andrewfelch at gmail.com
Tue Feb 27 19:49:31 EST 2007
On Feb 27, 3:47 pm, "Ziga Seilnacht" <ziga.seilna... at gmail.com> wrote:
> Andrew Felch wrote:
> > Thanks for checking. I think I narrowed the problem down to
> > inheritance. I inherit from list or some other container first:
>
> > class PointList( list, AutoReloader ):
> > def PrintHi1(self):
> > print "Hi2"
>
> > class MyPrintingClass( AutoReloader ):
> > def PrintHi2(self):
> > print "Hi2v2"
>
> > Automatic reloading works for MyPrintingClass but not for PointList.
> > Any ideas?
>
> > -Andrew
>
> Ah yes, this is the problem of list.__new__ not calling the next
> class in MRO. Try to switch the bases, so that AutoReloader's
> __new__ method will be called first.
>
> Ziga
That did it! Thanks so much!
This really seems to extend Python to be a much better rapid
prototyping langauge. It certainly allows me to now use classes where
I avoided them like the plague before. Perhaps I'll be able to make
programs > 1500 lines now! :-)
-Andrew
More information about the Python-list
mailing list