We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A common pattern in the Kubernetes generator is to create and populate arrays using the += operator on Dict.
+=
item.root.volumeMounts += [value]
It works because the addict Dict implementation override __add__ to return the passed value if the Dict is empty (and raise an error otherwise).
addict
__add__
def __add__(self, other): if not self.keys(): return other else: self_type = type(self).__name__ other_type = type(other).__name__ msg = "unsupported operand type(s) for +: '{}' and '{}'" raise TypeError(msg.format(self_type, other_type))
Which means this previous snippet will :
[value]
Should this package support this too ?
The text was updated successfully, but these errors were encountered:
I think that's a great idea as it removes the need to check if it exists, etc...
Sorry, something went wrong.
No branches or pull requests
A common pattern in the Kubernetes generator is to create and populate arrays using the
+=
operator on Dict.It works because the
addict
Dict implementation override__add__
to return the passed value if the Dict is empty (and raise an error otherwise).Which means this previous snippet will :
[value]
.[value]
to the array created on first call.Should this package support this too ?
The text was updated successfully, but these errors were encountered: