-1

Well...When I define a function that does not perform certain actions I don't understand what the difference between ... and pass. For example, the following two pieces of code:

def _clear() -> None: ...
def _clear() -> None: pass

They are the same, right? Either one can be used? I sincerely hope someone can help me thoroughly understand it. Thanks...

Runstone
  • 368
  • 2
  • 8
  • Note that I only attempted to answer the second half of this question which is not the same as that duplicate. The first half is the same. – Houston Fortney Nov 22 '19 at 04:00

1 Answers1

0

pass is the standard way to say that a function does not do anything.

Placing the ellipsis object does yield valid code just like def _clear() -> None: x = 5, but most IDEs and static analysis tools will complain that the statement has no effect.

Houston Fortney
  • 109
  • 1
  • 2