then config_options
would be {'command_prefix': '?', 'post_limit': 5)
, and the cls(**config_options)
would expand to BotConfig(command_prefix='?', post_limit=5, posting_limit=3, presence=['hard to get'])
, and a "TypeError: BotConfig() got an unexpected keyword argument 'post_limit'"
exception would be raised (or missing token
or db_url
or search
keyword, because I was lazy).
Or, if you get tired of typing in self.
for all the fields (I'm looking at Listing#__str__Listing.__str__
), {key}
will be replaced with the keyword argument given in the format(...) arguments, and the splat operator turns the self.__dict__
into key=value
pairs, for use as the keyword arguments for format(...)
: