Skip to content

Commit fc5879a

Browse files
committed
Added a comment about why we're not copying vars(self)
1 parent 579eeb1 commit fc5879a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

yamlable/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def __to_yaml_dict__(self):
4949
Implementors should transform the object into a dictionary containing all information necessary to decode the
5050
object in the future. That dictionary will be serialized as a YAML mapping.
5151
52-
Default implementation returns vars(self). TODO maybe some day we'll need to rather make a copy...?
52+
Default implementation returns vars(self).
5353
:return:
5454
"""
5555
# Legacy compliance with old 'not dunder' method name TODO remove in future version
@@ -58,7 +58,7 @@ def __to_yaml_dict__(self):
5858
"supported in future version, please use '__to_yaml_dict__' instead")
5959
return self.to_yaml_dict()
6060

61-
# Default: return vars
61+
# Default: return vars(self) (Note: no need to make a copy, pyyaml does not modify it)
6262
return vars(self)
6363

6464
@classmethod

0 commit comments

Comments
 (0)