summaryrefslogtreecommitdiff
path: root/pypers/bug.txt
blob: 5bc410d2440d73e1b69435d9ea806e394c47dbb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Ask why SyntaxError

from oopp import customized

class Customizable(object):
    """Classes inhering from 'Customizable' have a 'with' method acting as
    an object modifier"""
    def __getitem__(self,**kw):
        print kw
    with=customized
    With=classmethod(customized)
    class __metaclass__(type):
        def __getitem__(cls,kw=None):
            print kw

c=Customizable()
c.with(a='a')
print c.a

Customizable.With(b='b')

#Customizable[a='b']

print c.b

print c[kw='a'] # SyntaxError: invalid syntax


def f(kw='b'): print kw

f(kw='a') # works