[Numpy-discussion] numarray unfriendly to user defined types

Fernando Perez fperez at colorado.edu
Mon Sep 22 16:42:02 EDT 2003

Tim Hochberg wrote:
> I actually have no idea how you plan to make keyword arguments work 
> here, perhaps you could explain that in more detail. Metaclasses are 
> overkill, but a mixin, marker class could be used. That is, when 
> designing a class for use with numarray, one would derive a class from a 
> marker class in numarray::

Well, the joys of being vague :)  As I said, I haven't followed in enough 
detail to be too specific, so perhaps my idea plain doesn't work.  But what I 
had in mind was something along the lines of:

class ArrayLike(numarray):
	def __init__(self,...):

This is ultimately equivalent to a registration process, but since it is done 
in the constructor, it feels less like a separate dangling side-effect.  On 
the other hand, it makes your new constructor more expensive, and it feels 
ugly to be doing at the instance level things which truly belong at the class 
level.  Hence my comment about this perhaps being better done via metaclasses.

As I said, I knew I was being vague.  But hopefully these comments at least 
suggest a way out of a separate registration step.



More information about the NumPy-Discussion mailing list