[Numpy-discussion] question about optimizing
Charles R Harris
charlesr.harris at gmail.com
Sat May 17 16:33:45 EDT 2008
On Sat, May 17, 2008 at 2:25 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On Sat, May 17, 2008 at 3:18 PM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
> > Base classes also tend to have limited functionality that will be common
> to
> > all derived types. The object type in Python has only a few methods and
> > attributes:
> >
> > In [4]: dir(object)
> > Out[4]:
> > ['__class__',
> > '__delattr__',
> > '__doc__',
> > '__getattribute__',
> > '__hash__',
> > '__init__',
> > '__new__',
> > '__reduce__',
> > '__reduce_ex__',
> > '__repr__',
> > '__setattr__',
> > '__str__']
> >
> > And overloading any of these is likely to cause trouble.
>
> Nonsense. *Most* of those are intended to be overloaded. Especially on
> object.
>
My bad. What I should have said is, if you change the semantics of these
methods and attributes, then things will go wrong. The Python documentation
says as much. For instance, if __new__ returns the time of day. So my point
would be: those things intended to be overloading are well defined and what
they do is part of the contract.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080517/98c109b4/attachment.html>
More information about the NumPy-Discussion
mailing list