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):
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:
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
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()
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)
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:
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