Home Subclassing a user-defined exception in a user-defined class in Python
Reply: 0

Subclassing a user-defined exception in a user-defined class in Python

user394
1#
user394 Published in April 25, 2018, 12:42 am

Why does this work:

class A:
    class BError(Exception):
        pass
    class CError(AError):
        pass

But this doesn't:

class A:
    class BError(Exception):
        pass
    class CError(A.BError):
        pass

If "method 1" works for calling class variables, why doesn't it work for "class classes"

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301873 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO