Skip to content

explicit send() arguments #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2018

Conversation

gronke
Copy link
Contributor

@gronke gronke commented Apr 10, 2018

Explicitly names arguments of the send() methods. This is particularly useful when using strong typing and working with the Python CLI.

libzfs.pyx Outdated
@@ -2401,19 +2401,16 @@ cdef class ZFSDataset(ZFSObject):
for i in self.children:
i.umount_recursive(force)

def send(self, fd, **kwargs):
def send(self, fd, fromname=None, toname=None, flags=set()):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set() is not a singletone, should not be used as argument:

>>> def test(foo, flags=set()):
...     flags.add(foo)
...     print(flags)
... 
>>> test('foo')
{'foo'}
>>> test('bar')
{'bar', 'foo'}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's amazing! That makes so much sense because the set() does not get created when calling the function. Great catch!

@william-gr william-gr merged commit 747701a into truenas:master Apr 10, 2018
@gronke gronke deleted the explicit-send-interfaces branch April 10, 2018 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants