[Python-Dev] On moving to new-style classes

skip@pobox.com skip at pobox.com
Tue Dec 13 16:39:32 CET 2005


    Jim> For debugging purposes, it's easy to add a property to allow
    Jim> debugging of attribute assignment.

Assuming you use new-style classes, which I often don't.  The property/debug
idea that you and Gustavo have both now mentioned makes them a bit more
attractive.

Is there a new-style class HOW-TO somewhere?  It would be useful to
summarize the advantages for them.  I still have this thought stuck in my
head (from where, I don't know, probably incorrect) that one of the main
reasons for new-style classes was to get rid of __dict__.

    Jim> Having to write accessors for all your public methods doesn't seem
    Jim> consistent with rapid development.  

I'd rather trade the 30 seconds it takes to write a simple accessor method
when I need it than the minute or two it takes to figure out where my
attribute got stomped.

I guess it mostly boils down to a matter of taste.  Did I also mention that
most of the programmers here are C++ folk?  They have their beloved inline
keyword.  <wink>

Skip


More information about the Python-Dev mailing list