Closed jin0g closed 1 year ago
Hi @jin0g,
Thank you for the question! Python's __dict__
exposes the variables and methods of an object. In ArgumentParser
, the object only contains the variables with the parsed arguments, so __dict__
only contains those variables. However, Tap
contains additional methods and variables that help perform argument parsing, so these methods and variables are also exposed as part of __dict__
. This is why we built Tap
's as_dict
method, which returns a dictionary that only contains variables with the parsed arguments, just like ArgumentParser
.
Best, Kyle and Jesse
TAP behaves differently from the original ArgumentParser's
__dict__
. In ArgumentParser, we can doargs.__dict__
to get a dict in which only the arguments we added are enumerated. In TAP, however, the__dict__
contains a variety of additional information. The methodargs.as_dict()
is given only to TAP, and which behaves the same as originalargs.__dict__
I expected. Why this difference? And is this a specification? thank you.