Classes in Python
Steven Taschuk
staschuk at telusplanet.net
Fri Apr 18 13:07:50 EDT 2003
Quoth Bill Martin:
> I'm wondering about the value of allowing a class definition like this:
>
> class C:
> pass
>
> [...] I know there must be a
> reason that python allows this kind of thing that I described, but I
> can't figure out what that reason could be. [...]
One slightly different form which I find very useful:
class HullBreachError(Exception):
pass
Everything I need is inherited from Exception, with the (ahem)
exception that I want this type of error to be a distinct class,
so try: ... except HullBreachError: ... works.
--
Steven Taschuk staschuk at telusplanet.net
"What I find most baffling about that song is that it was not a hit."
-- Tony Dylan Davis (CKUA)
More information about the Python-list
mailing list