[Numpy-discussion] basic python questions

Sebastian Haase haase at msg.ucsf.edu
Thu Apr 5 01:07:09 EDT 2007


On 4/4/07, Bill Baxter <wbaxter at gmail.com> wrote:
> On 4/5/07, Robert Kern <robert.kern at 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)
>
Not really answering your question -- but I have complained about that
tutorial before, with regards to new language features ... it does not
mention
from __future__ import division
In my mind this should be put at the very front - because it's going
to be a very big thing once Python 3000 comes around.
The Python-list people did not like my arguing because apparently the
tutorial is supposed to "look nice" ....  [[ don't get me wrong,  I
really recommend the tutorial, I like it, I think it's good ]]
But some (even if) ugly things should be said up front, if they clear
up the way.
Python 3000 will also default to new-style classes -- so that
"(object)" thing would go away again if I'm not mistaken.

-Sebastian

PS:
Maybe this list could officially endorse the
from __future__ import division
I would be very interested in this !
Math becomes clearer, and  things like  arr[5/2]  won't only suddenly
fail in the future,  they should be NOW written as arr[5//2] (if you
need integer division)
Thanks. [[ please start a new thread, and put up a page on the wiki ;-) ]]



More information about the NumPy-Discussion mailing list