
Jim Fulton wrote:
Gordon McMillan wrote:
...
Violating Pythonic expectations by, in effect, creating 2 methods list.pop(void) list.pop(default_return)
Yes, except that I disagree that this is non-pythonic.
I'll leave the final determination to Mr. Python, but I disagree. Offhand I can't think of a built-in that can't be expressed in normal Python notation, where "optional" args are really defaulted args. Which would lead us to either a new list method, or redefining pop: def pop(usedefault=0, default=None) and making you use 2 args. But maybe I've missed a precedent because I'm so used to it. (Hmm, I guess string.split is a sort-of precedent, because the first default arg behaves differently than anything you could pass in). - Gordon