提交 0787e40b authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Param used to have only mutable flag. Borrow is a subset of mutable. All old

code that used to set mutable to true will issue a warning without this fix, because you can not have mutable True and borrow False (default value). Getting that warning when you only set mutable but not borrow seems very annoying and unneccessary.
上级 ef73f0fc
...@@ -276,6 +276,11 @@ class Param(object): ...@@ -276,6 +276,11 @@ class Param(object):
self.default = default self.default = default
self.name = name self.name = name
self.mutable = mutable self.mutable = mutable
# Mutable implies borrow. You can get borrow = False because of the
# default and it is a bit annoying to require the user to set both
# borrow and mutable to True
if mutable:
borrow = True
self.strict = strict self.strict = strict
self.allow_downcast = allow_downcast self.allow_downcast = allow_downcast
self.implicit = implicit self.implicit = implicit
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论