Skip to content Skip to sidebar Skip to footer
Showing posts with the label Metaclass

The Built-in Keyword Type Means A Function Or A Class In Python?

In most posts, people often say type is a built-in function if it is provided with one argument, an… Read more The Built-in Keyword Type Means A Function Or A Class In Python?

Weird Inheritance With Metaclasses

I'm experiencing some really weird problems in Python when trying to inherit from a class with … Read more Weird Inheritance With Metaclasses

How To Register Implementation Of Abc.mutablemapping As A Dict Subclass?

I would like my SpreadSheet class below to be considered a dict subclass by the isinstance() built-… Read more How To Register Implementation Of Abc.mutablemapping As A Dict Subclass?

Who Calls The Metaclass

This actually stems from a discussion here on SO. Short version def meta(name, bases, class_dict) … Read more Who Calls The Metaclass

Python Apply Decorator To Every Method In A Class Without Inspect

Slightly modifying the answer from Applying python decorators to methods in a class, it is possible… Read more Python Apply Decorator To Every Method In A Class Without Inspect

When Calling The Metaclass Bases, Object.__init__() Takes No Parameters

When I try to use this one approach of singleton: class Singleton(object): … Read more When Calling The Metaclass Bases, Object.__init__() Takes No Parameters

Nose, Unittest.testcase And Metaclass: Auto-generated Test_* Methods Not Discovered

This is a follow-up question for unittest and metaclass: automatic test_* method generation: For th… Read more Nose, Unittest.testcase And Metaclass: Auto-generated Test_* Methods Not Discovered

Subclass __module__ Set To Metaclass Module When Manually Creating New Class With Type()

In the following example, the newly created subclass ends up being the metaclass __module__ rather … Read more Subclass __module__ Set To Metaclass Module When Manually Creating New Class With Type()