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
Better, define a speaking constructor and add a class method from_arguments()
from_arguments()
https://www.erol.si/2016/01/python-and-multiple-constructors/
The text was updated successfully, but these errors were encountered:
e.g.
class Span(object): def __init__(self, uid: int = None, begin: int = 0, length: int = None, text: str = ''): self.uid = uid self.begin = begin self.text = text if length is None: length = len(text) self.length = length @classmethod def from_arguments(cls, **kwargs): return cls( uid=kwargs.get('uid', None), begin=kwargs.get('begin', 0), length=kwargs.get('length', 0), text=kwargs.get('text', "") )
Sorry, something went wrong.
No branches or pull requests
Better, define a speaking constructor and add a class method
from_arguments()
https://www.erol.si/2016/01/python-and-multiple-constructors/
The text was updated successfully, but these errors were encountered: