Re: [Python-Dev] The role of NotImplemented: What is it for and when should it be used?

2014-11-04 Thread Nick Coghlan
It's worth noting that as far as I am aware, all the cases where CPython currently raises TypeError directly rather than returning NotImplemented are due to a longstanding bug in the handling concatenation and repetition of sequences implemented entirely in C (which includes the builtins):

Re: [Python-Dev] [Python-checkins] cpython (2.7): Issue #22773: fix failing test with old readline versions due to issue #19884.

2014-11-04 Thread Benjamin Peterson
On Tue, Nov 4, 2014, at 09:55, antoine.pitrou wrote: https://hg.python.org/cpython/rev/eba6e68e818c changeset: 93382:eba6e68e818c branch: 2.7 parent: 93379:e54d0b197c82 user:Antoine Pitrou solip...@pitrou.net date:Tue Nov 04 14:52:10 2014 +0100 summary:

Re: [Python-Dev] [Python-checkins] cpython (2.7): Issue #22773: fix failing test with old readline versions due to issue #19884.

2014-11-04 Thread Antoine Pitrou
On Tue, 04 Nov 2014 09:58:29 -0400 Benjamin Peterson benja...@python.org wrote: On Tue, Nov 4, 2014, at 09:55, antoine.pitrou wrote: https://hg.python.org/cpython/rev/eba6e68e818c changeset: 93382:eba6e68e818c branch: 2.7 parent: 93379:e54d0b197c82 user:Antoine

[Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Roberto Martínez
Hi folks, I am trying to replace dinamically the __call__ method of an object using setattr. Example: $ cat testcall.py class A: def __init__(self): setattr(self, '__call__', self.newcall) def __call__(self): print(OLD) def newcall(self): print(NEW) a=A()

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Nathaniel Smith
On Tue, Nov 4, 2014 at 4:52 PM, Roberto Martínez robertomartin...@gmail.com wrote: Hi folks, I am trying to replace dinamically the __call__ method of an object using setattr. Example: $ cat testcall.py class A: def __init__(self): setattr(self, '__call__', self.newcall)

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Ethan Furman
This list is for the development _of_ Python, not development _with_ Python. Try asking on Python List. (forwarding...) On 11/04/2014 08:52 AM, Roberto Martínez wrote: I am trying to replace dinamically the __call__ method of an object using setattr. Example: $ cat testcall.py class A:

Re: [Python-Dev] Dinamically set __call__ method

2014-11-04 Thread Skip Montanaro
On Tue, Nov 4, 2014 at 10:52 AM, Roberto Martínez robertomartin...@gmail.com wrote: $ cat testcall.py class A: You are using old-style classes in Python 2.7 unless you explicitly inherit from object. If I vary the class line to be class A(object): I get the same behavior with 2.7 as you see