Created
February 11, 2020 21:58
-
-
Save jasonbot/68d7188d5d03692a040c55c65792d63b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class TemperamentalClass(type): | |
@classmethod | |
def __instancecheck__(cls, other): | |
return random.choice([True, False]) | |
class MyClass(metaclass=TemperamentalClass): | |
pass | |
for x in range(5): | |
print(isinstance(None, MyClass)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment