Skip to content

Instantly share code, notes, and snippets.

@jontsai
Forked from jasonbot/letsbeawful.py
Created October 8, 2022 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jontsai/458b3eeae873cdf8af5f3e905a9c930a to your computer and use it in GitHub Desktop.
Save jontsai/458b3eeae873cdf8af5f3e905a9c930a to your computer and use it in GitHub Desktop.
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