~yacinechaouche/+junk/BZR

« back to all changes in this revision

Viewing changes to CODE/TEST/PYTHON/attr.py

  • Committer: yacinechaouche at yahoo
  • Date: 2015-01-14 22:23:03 UTC
  • Revision ID: yacinechaouche@yahoo.com-20150114222303-6gbtqqxii717vyka
Ajout de CODE et PROD. Il faudra ensuite ajouter ce qu'il y avait dan TMP

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
def foo(c):
 
2
    foo.a += c
 
3
    return foo.a
 
4
 
 
5
def foo_init(c):
 
6
    foo.a = c
 
7
 
 
8
foo.init = foo_init
 
9
foo.init(0)
 
10
print foo(9)
 
11
print foo(9)
 
12
 
 
13
# >>> Traceback (most recent call last):
 
14
#   File "<stdin>", line 1, in <module>
 
15
#   File "/home/chaouche/CODE/TEST/PYTHON/attr.py", line 4
 
16
#     foo.init = lambda x:foo.a = x
 
17
# SyntaxError: can't assign to lambda
 
18
# >>>