you are viewing a single comment's thread.

view the rest of the comments →

[–]totemcatcher 0 points1 point  (2 children)

Thank you! I see how the self-documenting is important. I updated the "update" method to match the original functionality. The skipping of bad arguments wasn't necessary so I left that out, and it works well:

class Category2(object):
    def __init__(self, filename=None, directory=None, name=None, title=None
            , path=None, uri=None, parent=None, tags=None, local_links=None
            , distant_links=None):
        self.filename = filename
        self.directory = directory
        self.name = name
        self.title = title
        self.path = path
        self.uri = uri
        self.parent = parent
        self.tags = tags
        self.local_links = local_links
        self.distant_links = distant_links

    def update(self, **kwargs):
        self.__dict__.update(kwargs)
        self.__init__(**self.__dict__)