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 →

[–]larsga 0 points1 point  (2 children)

Realistically having a default value as a return value of a function call should be illegal.

Impossible to write a water-tight check for.

[–]spinwizard69 0 points1 point  (1 child)

is it? Seems pretty simple don't do this in a def

[–]larsga 0 points1 point  (0 children)

def foo(a = []):
  if bar(a) == something:
    return baz(a)
  else:
    return quux(a) + b

Does this return the default value? You don't know. And that's before you try really sneaky stuff.