[Python-ideas] Prevent importing yourself?

Chris Angelico rosuav at gmail.com
Wed Feb 3 20:04:51 EST 2016


On Thu, Feb 4, 2016 at 11:30 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> (3) Your code relies on the "module is a singleton" invariant that you
> have just violated. (If you ever do something like `if type(obj) is
> MyClass`, you're relying on that invariant.)

If ever you do "except MyException:", you're relying on that invariant, too.

ChrisA


More information about the Python-ideas mailing list