Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Sven R. Kunze
On 04.02.2016 19:35, Random832 wrote: On Thu, Feb 4, 2016, at 11:18, Sven R. Kunze wrote: On 04.02.2016 00:47, Random832 wrote: On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: Actually a nice idea if there were no overhead of creating methods for all heap instances separately. I'll keep th

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Random832
On Thu, Feb 4, 2016, at 11:18, Sven R. Kunze wrote: > On 04.02.2016 00:47, Random832 wrote: > > On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: > >> Actually a nice idea if there were no overhead of creating methods for > >> all heap instances separately. I'll keep that in mind. :) > > What abo

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Sven R. Kunze
On 04.02.2016 00:47, Random832 wrote: On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: Actually a nice idea if there were no overhead of creating methods for all heap instances separately. I'll keep that in mind. :) What about changing the class of the object to one which is inherited from i

Re: Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Random832
On Wed, Feb 3, 2016, at 16:50, Ben Finney wrote: > (You will also have a “reply to all” command. That's almost never > appropriate in a forum like this.) Why not? People reply all to messages I write all the time, and I find it somewhat useful since it separates replies to things I have said from

Re: Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Chris Angelico
On Thu, Feb 4, 2016 at 11:43 AM, Bernardo Sulzbach wrote: > For this list, and this list only (I likely could identify the issue > by comparing raw messages, but I won't bother), when I hit 'r' I get > the sender of the latest message. In this case, "ros...@gmail.com". So > I have to start typing

Re: Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Bernardo Sulzbach
For this list, and this list only (I likely could identify the issue by comparing raw messages, but I won't bother), when I hit 'r' I get the sender of the latest message. In this case, "ros...@gmail.com". So I have to start typing "pyt" to change it to the list, double tab to body, type, then Ctrl

Re: Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Chris Angelico
On Thu, Feb 4, 2016 at 11:03 AM, Bernardo Sulzbach wrote: > This got a little big. I accidentally did not change the address from > Sven's to the list and emailed him. Seconds later, he replied to the > list quoting my entire message so that I wouldn't have to send it to > the list too (after his

Re: Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Bernardo Sulzbach
This got a little big. I accidentally did not change the address from Sven's to the list and emailed him. Seconds later, he replied to the list quoting my entire message so that I wouldn't have to send it to the list too (after his reply, which would make it hard to understand). I thanked him for t

Re: Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Steven D'Aprano
On Thu, 4 Feb 2016 08:50 am, Ben Finney wrote: > (You will also have a “reply to all” command. That's almost never > appropriate in a forum like this.) If your mail client lacks Reply To List, use Reply All and then manually edit the To addresses of the new message. It honestly isn't hard, I've b

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Random832
On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: > Actually a nice idea if there were no overhead of creating methods for > all heap instances separately. I'll keep that in mind. :) What about changing the class of the object to one which is inherited from its original class and has the method

Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Ben Finney
Bernardo Sulzbach writes: > Thanks for quoting, for some reason my client always replies to the > person and not the list (on this list only). You have a “reply to sender” command in your mail client; every client has that. It seems that is what you used (it might just be named “reply”). Such re

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 22:34, Bernardo Sulzbach wrote: Did Peter's suggestion work? Somewhat for a single Heap class. However, it breaks inheritance. -- https://mail.python.org/mailman/listinfo/python-list

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 22:15, Peter Otten wrote: The technical reason is that functions written in C don't implement the descriptor protocol. The bound method is created by invoking the __get__ method of the class attribute: Good to know. :-/ It's sad. These functions just look so method-like. Bes

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 22:19, Peter Otten wrote: You could try putting self.heappush = functools.partial(heapq.heappush, self) into the initializer. Actually a nice idea if there were no overhead of creating methods for all heap instances separately. I'll keep that in mind. :) -- https://mail.pytho

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Bernardo Sulzbach
Did Peter's suggestion work? -- https://mail.python.org/mailman/listinfo/python-list

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 22:14, Bernardo Sulzbach wrote: Thanks for quoting, for some reason my client always replies to the person and not the list (on this list only). I did what I could. I could show you a lambda function there, but it doesn't solve anything. If there is a way to avoid a wrapper, I don'

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Peter Otten
Sven R. Kunze wrote: > On 03.02.2016 22:06, Bernardo Sulzbach wrote: >> I may say something wrong, but this is what I see going on: >> >> When you get "replace = heapreplace" you are creating a data attribute >> called replace (you will access it by self.replace or >> variable.replace) that is an

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Bernardo Sulzbach
Thanks for quoting, for some reason my client always replies to the person and not the list (on this list only). I did what I could. I could show you a lambda function there, but it doesn't solve anything. If there is a way to avoid a wrapper, I don't know. -- https://mail.python.org/mailman/list

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Peter Otten
Sven R. Kunze wrote: > Hi, > > as you might have noticed, I am working on > https://github.com/srkunze/xheap right now. > > In order to make it even faster and closer to heapq's baseline > performance, I wonder if there is a possibility of creating fast > wrappers for functions. > > > Please c

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 22:06, Bernardo Sulzbach wrote: I may say something wrong, but this is what I see going on: When you get "replace = heapreplace" you are creating a data attribute called replace (you will access it by self.replace or variable.replace) that is an alias for heapreplace. When you cal

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
On 03.02.2016 21:40, Bernardo Sulzbach wrote: I am not entirely sure about what your question is. Are you talking about the "heapreplace expected 2 arguments, got 1" you get if you set replace = heapreplace? Yes, I think so. I might ask differently: why do I need to write wrapper method when

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Bernardo Sulzbach
I am not entirely sure about what your question is. Are you talking about the "heapreplace expected 2 arguments, got 1" you get if you set replace = heapreplace? -- https://mail.python.org/mailman/listinfo/python-list

Efficient Wrappers for Instance Methods

2016-02-03 Thread Sven R. Kunze
Hi, as you might have noticed, I am working on https://github.com/srkunze/xheap right now. In order to make it even faster and closer to heapq's baseline performance, I wonder if there is a possibility of creating fast wrappers for functions. Please compare https://github.com/srkunze/xhe