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
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...
"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 5/3/2012 4:57 PM, nbv4 wrote:
Instead of
class CustomException(Exception): pass
how about just
class CustomException(Exception)
How about just: class CustomException(Exception): pass or better yet, using more lines? --Ned.
(no colon, no 'pass') I'm sure this has been suggested before, but I couldn't find any...
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
participants (3)
-
Chris Rebert
-
nbv4
-
Ned Batchelder