Skip to content

Instantly share code, notes, and snippets.

View kurtbrose's full-sized avatar
💭
carbon based

Kurt Rose kurtbrose

💭
carbon based
View GitHub Profile
@judy2k
judy2k / know_thyself.py
Last active July 5, 2022 06:35
__qualname__ implementation in Python 2
from inspect import isclass
import __builtin__
# We're going to overwrite object, so we need to squirrel away the old one:
obj = object
# Metaclass, overriding the class' __getattribute__,
# so that __qualname__ can be generated and cached on access:
class QualnameMeta(type):
import sys
lines = {}
def start():
sys.settrace(trace)
def stop():
sys.settrace(None)
for filename in lines: