[Numpy-discussion] basic python questions

Eric Firing efiring@hawaii....
Wed Apr 4 22:10:58 CDT 2007


Robert Kern wrote:
> Bill Baxter wrote:
>> On 4/5/07, Robert Kern <robert.kern@gmail.com> wrote:
>>> Bill Baxter wrote:
>>>> Ok, I got another hopefully easy question:
>>>>
>>>> Why this:
>>>>     class Point(object):
>>>>           ...
>>>>
>>>> Instead of the style that's used in the Python tutorial in the
>>>> 'classes' chapter:
>>>>     class Point:
>>>>         ...
>>> Because the former make new-style classes and the latter make old-style classes.
>>> It's not an issue of personal preference: they are somewhat different object
>>> models and there are things that old-style classes can't do. As HasTraits is
>>> also a new-style class, there's no point in using old-style classes in this
>>> tutorial.
>> What's the difference in the object models?  I'm surprised that the
>> Python tutorial seems to be completely silent on this issue.
>> (http://docs.python.org/tut/node11.html)
> 
> http://www.python.org/doc/newstyle.html
> 

Key point: properties work with new-style classes but fail silently and 
mysteriously with classic classes.

Eric



More information about the Numpy-discussion mailing list