one line class definitions

Instead of class CustomException(Exception): pass how about just class CustomException(Exception) (no colon, no 'pass') I'm sure this has been suggested before, but I couldn't find any...

On Thu, May 3, 2012 at 1:57 PM, nbv4 <nbvfour@gmail.com> wrote:
"Special cases aren't special enough to break the rules." -- PEP 20 Just use a docstring-only body; you should be documenting what the exception means anyways: class CustomException(Exception): """This exception means that a custom error happened.""" # other module-level code… Cheers, Chris

On Thu, May 3, 2012 at 1:57 PM, nbv4 <nbvfour@gmail.com> wrote:
"Special cases aren't special enough to break the rules." -- PEP 20 Just use a docstring-only body; you should be documenting what the exception means anyways: class CustomException(Exception): """This exception means that a custom error happened.""" # other module-level code… Cheers, Chris
participants (3)
-
Chris Rebert
-
nbv4
-
Ned Batchelder