[Python-Dev] lament for the demise of unbound methods (original) (raw)
Chris Withers chris at simplistix.co.uk
Sun Jul 7 08:40:01 CEST 2013
- Previous message: [Python-Dev] lament for the demise of unbound methods
- Next message: [Python-Dev] lament for the demise of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 05/07/2013 11:26, "Martin v. Löwis" wrote:
...
A.getattribute(A,'s') <staticmethod object at 0x100937828> A.getattribute(A,'c') <classmethod object at 0x100937860> A.getattribute(A,'r') <function A.r at 0x100938378>
Okay, but with this line:
found = found.getattribute(found, n)
I get a tonne of failures like this:
File "<doctest
testfixtures.tests.test_replacer.TestReplacer.test_with_statement[3]>", line 2, in r.replace('testfixtures.tests.sample1.z',test_z) File "/Users/chris/LocalGIT/testfixtures/testfixtures/replace.py", line 50, in replace container, method, attribute, t_obj = resolve(target) File "/Users/chris/LocalGIT/testfixtures/testfixtures/resolve.py", line 17, in resolve found = found.getattribute(found, n) TypeError: expected 1 arguments, got 2
If I change it to :
found = found.getattribute(n)
I get fewer failures, but still plenty, now of the form:
File "<doctest
testfixtures.tests.test_replacer.TestReplacer.test_multiple_replace[7]>", line 1, in r.replace('testfixtures.tests.sample1.X.y',test_y) File "/Users/chris/LocalGIT/testfixtures/testfixtures/replace.py", line 50, in replace container, method, attribute, t_obj = resolve(target) File "/Users/chris/LocalGIT/testfixtures/testfixtures/resolve.py", line 17, in resolve found = found.getattribute(n) TypeError: expected 1 arguments, got 0
...so I'm back to:
found = found.dict[n]
...and having to catch both KeyError and AttributeError.
Chris
-- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
- Previous message: [Python-Dev] lament for the demise of unbound methods
- Next message: [Python-Dev] lament for the demise of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]