Hi,
I am curious when one should implement a "__call__()" and when a
"__getitem__()" method.
For example, I want to display functions and data in the same plot. For
a function, the natural interface would to be called as "f(x)", while
the natural interface for data would be "f[x]". On the other
sturlamolden writes:
> On 2 Okt, 13:29, Dave Angel wrote:
> If you are worried about speed, chances are you are not using Python
> anyway.
I *do* worry about speed. And I use Python. Why not? There are powerful
libraries available.
> If you still have "need for speed" on a multicore, you can us
Hi Peter,
Peter Otten <__pete...@web.de> writes:
I am a bit surprised that already such a simple problem is virtually
unsolvable in python.
> Btw, have you implemented such a design in another language?
No.
> I think I'd go for a simpler approach, manage the lifetime of MyClass
> i
Hi Peter,
Peter Otten <__pete...@web.de> writes:
> class Method(object):
> def __init__(self, obj, func=None):
> if func is None:
> func = obj.im_func
> obj = obj.im_self
This requires that func is a bound method. What I want is to have a
universal class that "
Hi Peter,
Peter Otten <__pete...@web.de> writes:
> Ole Streicher wrote:
>> Peter Otten <__pete...@web.de> writes:
>>>> What I want is to have a universal class that "always" works: with
>>>> unbound functions, with bound function, with
Hello Peter,
Peter Otten <__pete...@web.de> writes:
>> What I want is to have a universal class that "always" works: with
>> unbound functions, with bound function, with lambda expressions, with
>> locally defined functions,
> That's left as an exercise to the reader ;)
Do you have the feeling t
Hi Miles,
Miles Kaufmann writes:
> You could also create a wrapper object that holds a weak reference to the
> instance and creates a bound method on demand:
> class WeakMethod(object):
> def __init__(self, bound_method):
> self.im_func = bound_method.im_func
> self.im_self =
Hello Peter,
Peter Otten <__pete...@web.de> writes:
> Is there an actual use case?
I discussed this in the german newsgroup. Here is the use in my class:
-8<---
import threading
import weakref
class DoAsync(threading.Thread):
def __init__(self,
Hi Thomas,
Thomas Lehmann writes:
>> r = weakref.ref(o.myfunc)
>> print r()
>> None
> k = o.myfunc
> r = weakref.ref(k)
> print r()
>>
> Don't ask me why! I have just been interested for what you are trying...
This is clear: in your case, o.myfunc is explicitely referenced by k,
th
Hi group,
I am trying to use a weak reference to a bound method:
class MyClass(object):
def myfunc(self):
pass
o = MyClass()
print o.myfunc
>
import weakref
r = weakref.ref(o.myfunc)
print r()
None
This is what I do not understand. The object "o" is still alive, and
t
Hi,
I am using epydoc for my code documentation and I am curious whether
there exist a possibility to produce the output in xml format.
Reason for that is that I want to convert it to WordML and get it into
our private documentation system.
Unfortunately, the documentation does not mention xml,
Hi John
John Machin writes:
> On Apr 25, 1:14 am, Ole Streicher wrote:
>> John Machin writes:
>> >> From my access pattern, it would be probably better to combine 25 rows
>> >> into one slice and have one matrix where every cell contains 25 rows.
>>
Hi John,
John Machin writes:
>> From my access pattern, it would be probably better to combine 25 rows
>> into one slice and have one matrix where every cell contains 25 rows.
>> Are there any objections about that?
> Can't object, because I'm not sure what you mean ... how many elements
> in a "
Arnaud Delobelle writes:
> numpy.ndarray has a __new__ method (and no __init__). I guess this is
> the one you should override. Try:
What is the difference?
best regards
Ole
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano writes:
> Perhaps you should post the full trace back instead of just the final
> line.
No Problem, although I dont see the information increase there:
In [318]: class da(ndarray):
.: def __init__(self, mydata):
.: ndarray.__init__(self, 0)
.
Hi again,
I am trying to initialize a class inherited from numpy.ndarray:
from numpy import ndarray
class da(ndarray):
def __init__(self, mydata):
ndarray.__init__(self, 0)
self.mydata = mydata
When I now call the constructor of da:
da(range(100))
I get the message:
ValueE
Hi Nick,
Nick Craig-Wood writes:
> I'd start by writing a function which took (x, y) in array
> co-ordinates and transformed that into (z) remapped in the Morton
> layout.
This removes the possibility to use the sum() and similar methods of
numpy. Implementing them myself is probably much worse
Hi John,
John Machin writes:
> The Morton layout wastes space if the matrix is not square. Your 100K
> x 4K is very non-square. Looks like you might want to use e.g. 25
> Morton arrays, each 4K x 4K.
What I found was that Morton layout shall be usable, if the shape is
rectangular and both dimens
Hi Nick,
Nick Craig-Wood writes:
> mmaps come out of your applications memory space, so out of that 3 GB
> limit. You don't need that much RAM of course but it does use up
> address space.
Hmm. So I have no chance to use >= 2 of these arrays simultaniously?
> Sorry don't know very much about n
Hi,
for my application, I need to use quite large data arrays
(100.000 x 4000 values) with floating point numbers where I need a fast
row-wise and column-wise access (main case: return a column with the sum
over a number of selected rows, and vice versa).
I would use the numpy array for that, b
Hi Eduardo,
Eduardo Lenz writes:
> On Wednesday 22 April 2009 04:47:54 David Cournapeau wrote:
>> On Wed, Apr 22, 2009 at 6:38 PM, Ole Streicher
> wrote:
>> > but scipy then fails:
>> > error: Lapack (http://www.netlib.org/lapack/) libraries not found.
>> &
Hi David,
David Cournapeau writes:
> On Fri, Mar 13, 2009 at 8:20 PM, gopal mishra wrote:
>> error: Setup script exited with error: None
> Numpy 1.3.0 (to be released 1st April 2009) will contain everything to
> be buildable and usable with python 2.6 on windows. If you are in a
> hurry, you can
22 matches
Mail list logo