You can use pass
, but also ...
is synonymous in Python 3.x, which can be nice for writing psuedocode.
I see a lot of people use pass
where they truly need to do nothing, while using ...
where they are using it as a placeholder.
class SomeInterface:
def do_something(self):
pass
class SomeImplementation(SomeInterface):
def do_something(self)
...
This makes it easy to search for ...
and find areas where you have unimplemented code, without the false positives from pass
.
Note that passing on an exception is generally a bad practice, as you will virtually always want to act on exceptions. You should definitely, at the very least, specify the exact exception(s) you want to catch, as otherwise you will catch all exceptions, potentially causing bugs you can't detect if a different exception rears it's head.