[EMAIL PROTECTED] wrote: > Bruno Desthuilliers wrote: > >>[EMAIL PROTECTED] wrote: (snip)
>>>and 2) what's the reason to use newstyle classes >>>versus the old? >> >>All this is explained on python.org (there's a menu entry for this in >>the documentation menu). AFAICT, newstyle classes can do whatever >>oldstyle classes did, *and much more* (descriptors and usable >>metaclasses) - and they are somewhat faster too. So - compatibility with >>older Python versions (< 2.2 IIRC) set aside -, there's just no reason >>to use oldstyle classes. >> >> >>> In order to create the dynamic class "NewClass" in the >>>code above I called type() but that requires at least one new style >>>class as a base. Thus, I had to have at least one of my animals inherit >>>from "object" and this seemed a nuisance since >> >>OMG, eight more keystrokes - talk about a nuisance... > > > Like, Oh My God! *claps hand to mouth* lol You humor me. Yes, eight > more keystrokes. I follow the general rule of, if I'm going to put in > extra effort, OMG, eight more keystrokes - talk about extra effort !-) > I'd like to know why. The only reason for *not* doing it would be compat issues with pre 2.2.x versions. > So you see, it's not so much an > adversion to the eight keystrokes (multiplied by however many classes I > have mind you), Strange enough, I do write my share of Python code, and don't even notice typing the EightKeystrokes. > but to not knowing why I should use them. Because they are kind of the standard Python object model since 2.2.x ?-) Did you at least take time to read the doc on newstyle classes on python.org ? FWIW, with 2.5, even exceptions are now newstyle classes. No more oldstyle classes in the builtins. And AFAICT, no more oldstyle classes in the standard lib neither. Does that ring a bell ? > If I don't > care for descriptors or metaclasses, You *do* care for descriptors. Without descriptors, no properties, no classmethods, no staticmethods... What a desolation :( More seriously, given what you're into actually, not caring about what one can do with newstyle classes seems really strange to me - like digging a swimming-pool with a pick and a shovel when you have an excavator... (disclaimer : google translation, not sure it makes sens in english...) > I don't see why I should feel > compelled to use them. "them" -> "newstyle classes" or "descriptors and metaclasses" ? > And when I decide I want/need these features, I > can put the eight keystroke in at that time. What can I say ? That's your code, not mine... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list