aubio/__init__.py: simplify, add support for list input
authorPaul Brossier <piem@piem.org>
Fri, 25 Dec 2009 05:13:14 +0000 (06:13 +0100)
committerPaul Brossier <piem@piem.org>
Fri, 25 Dec 2009 05:13:14 +0000 (06:13 +0100)
interfaces/python/aubio/__init__.py

index 85c71808d191f637342f1a5c4fdfff5f3c08ba12..136848b111b857d52a2b400f0024aa21506dd7ce 100644 (file)
@@ -3,9 +3,7 @@ from _aubio import *
 
 class fvec(numpy.ndarray):
 
-    def __init__(self, length = 1024, **kwargs):
-        super(numpy.ndarray, self).__init__(**kwargs)
-
     def __new__(self, length = 1024, **kwargs):
-        self = numpy.zeros(length, dtype='float32', **kwargs)
-        return self
+        if type(length) == type([]):
+            return numpy.array(length, dtype='float32', **kwargs)
+        return numpy.zeros(length, dtype='float32', **kwargs)