提交 bb724bc6 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Small fix to doc about shared containers with non implicit input, updated related test accordingly

上级 acd652a3
......@@ -168,9 +168,9 @@ This is illustrated in the following example.
>>> dec(1, 0) # Try to manually set an implicit input
<type 'exceptions.TypeError'>: Tried to provide value for implicit input: s
>>> dec = function([x, In(s, update=(s-x), value=inc.container[s], implicit=False)], [])
>>> print dec[s] # dec has its own container for s, not yet filled
None
>>> inc[s] = 2
>>> print dec[s] # Containers are shared
2.0
>>> dec(1)
[]
>>> print inc[s] # Calling dec decreased the value in inc's container
......@@ -179,7 +179,7 @@ None
[]
>>> print inc[s]
-1.0
>>> print dec[s] # Still shared.
>>> print dec[s] # Still shared
-1.0
Input Argument Restrictions
......
......@@ -267,6 +267,7 @@ class T_function(unittest.TestCase):
implicit = False)], [])
self.failUnless(dec[s] is inc[s])
inc[s] = 2
self.failUnless(dec[s] == 2)
dec(1)
self.failUnless(inc[s] == 1)
dec(1, 0)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论