MCPcopy Index your code
hub / github.com/bslatkin/effectivepython / __new__

Method __new__

example_code/item_062.py:52–60  ·  view source on GitHub ↗
(meta, name, bases, class_dict)

Source from the content-addressed store, hash-verified

50print("Example 1")
51class Meta(type):
52 def __new__(meta, name, bases, class_dict):
53 global print
54 orig_print = print
55 print(f"* Running {meta}.__new__ for {name}")
56 print("Bases:", bases)
57 print = pprint
58 print(class_dict)
59 print = orig_print
60 return type.__new__(meta, name, bases, class_dict)
61
62class MyClass(metaclass=Meta):
63 stuff = 123

Callers 3

__new__Method · 0.45
__new__Method · 0.45
__new__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected