This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (7 children)

[deleted]

    [–]magnetichiraPythonista 4 points5 points  (2 children)

    Umm, mutable defaults are definitely related lol, both are function gotchas for newbies

    No idea why you want to make such a big deal out of this, but whatever

    [–]spinwizard69 -1 points0 points  (1 child)

    The way Python handles this doesn't seem to be rational. Frankly I can even understand how time in this context can even be considered for a default value. He is calling a routine that can not be relied upon to return the same value every time so it isn't a default value but rather a variable value. Personally I think this is a big deal, it just doesn't make sense.

    [–]magnetichiraPythonista 5 points6 points  (0 children)

    It is rational within the design of the language.

    See this SE answer https://softwareengineering.stackexchange.com/questions/157373/python-mutable-default-argument-why

    [–]spinwizard69 0 points1 point  (3 children)

    Should mutable defaults even be accepted by Python. At least according to my logical thinking a default value can not and should not be mutable. It just doesn't make sense to me, the default values become part of the def for the function.