Skip to content

Instantly share code, notes, and snippets.

@nvgoldin
Created March 19, 2017 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvgoldin/d7ad6233108afd092d0107c664a0a109 to your computer and use it in GitHub Desktop.
Save nvgoldin/d7ad6233108afd092d0107c664a0a109 to your computer and use it in GitHub Desktop.
getting nets
In [1]: class vm(object):
...: def __init__(self, nets):
...: self.nets = nets
...:
In [2]: vms = [ vm(nets=['1', '2']), vm(nets=['2', '9']), vm(nets=['3', '2']) ]
In [3]: set((net for vm in vms for net in vm.nets))
Out[3]: {'1', '2', '3', '9'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment