[SciPy-user] NumPy arrays of Python objects (it was Re: How to start with SciPy and NumPy)

Vicent vginer at gmail.com
Mon Jan 26 11:56:54 EST 2009


On Mon, Jan 26, 2009 at 12:45, David Cournapeau <
david at ar.media.kyoto-u.ac.jp> wrote:

> Vicent wrote:
> >
> > (2) Just to be sure: An array can be assigned to a property of an
> > object, can't it?
>
> A numpy array is a 'full' python object, thus can be used in the same
> cases as a python object.



Sorry I meant "working with classes" vs "working with structures or
records".

I know that everything in Python is an object, but I was thinking of
building my own structures for storing information by using "classes", in a
OOP context.

There I realize that maybe I have to forget defining "classes" and just use
NumPy objects, for those heavy/intensive search and/or computing tasks in my
code.

[ Again, asking myself...: Do I miss something? I mean, actually, a NumPy
array has properties/attributes and methods... So, maybe using objects from
NumPy doesn't mean forget object oriented programming. I think I was a bit
confused about it... ]


Working with object or not is not generally the most relevant aspect of
> good design - if you can do the same with a few functions and standard
> python objects/containers, it is often simpler and better to use them.



That's true... In fact, for me, I think it's a matter of programming
style...

-- 
Vicent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090126/adbf15e4/attachment.html>


More information about the SciPy-User mailing list