Thanks a lot! You guys provide quite better ways than mine! finally for 1 or 2 arguments, I would use ``` a = a if a is None else self.a ``` if there are too many arguments, I would like to adopt the decoration idea (Ricky Teachey), which seems better.
Sorry for the `eval` part error, that is not well tested before I posted. And another potential error for my initial post is `'self'` is not a good default value since many other types can't compare with `str`. `None` will be much better but will be annoying when we really want to pass `None` to the argument though. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/5WBG2AAGPGF4ANS4WMUFYYEZY3QKIRMS/ Code of Conduct: http://python.org/psf/codeofconduct/