Cython has moved to github.
cython-devel
view tests/run/getattr3call.pyx @ 2194:b9d8cecc8975
general optimisation support for calls to builtin types and their methods
currently providing optimisations for
- getattr(o,a)
- getattr(o,a,d)
- X.append(o)
- L.append(o)
- list.append(L,x)
currently providing optimisations for
- getattr(o,a)
- getattr(o,a,d)
- X.append(o)
- L.append(o)
- list.append(L,x)
| author | Stefan Behnel <scoder@users.berlios.de> |
|---|---|
| date | Sun Mar 29 13:27:55 2009 +0200 (3 years ago) |
| parents | 6309e21af543 |
| children | 627d042ab771 |
line source
1 __doc__ = u"""
2 >>> class test(object): a = 1
3 >>> t = test()
5 >>> f(t, 'a')
6 1
7 >>> f(t, 'b')
8 Traceback (most recent call last):
9 AttributeError: 'test' object has no attribute 'b'
11 >>> g(t, 'a', 2)
12 1
13 >>> g(t, 'b', 2)
14 2
16 >>> h(t, 'a', 2)
17 1
18 >>> h(t, 'b', 2)
19 2
20 """
22 def f(a, b):
23 return getattr(a, b)
25 def g(a, b, c):
26 return getattr3(a, b, c)
28 def h(a, b, c):
29 return getattr(a, b, c)
