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

Is It Possible To Dynamically Create A Metaclass For A Class With Several Bases, In Python 3?

In Python 2, with a trick it is possible to create a class with several bases, although the bases h… Read more Is It Possible To Dynamically Create A Metaclass For A Class With Several Bases, In Python 3?

Arguments Of __new__ And __init__ For Metaclasses

I am a bit surprised by the method call order and the different arguments when overriding new and i… Read more Arguments Of __new__ And __init__ For Metaclasses

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?

Python Class Inherited Singleton Inits Instance On Every Call

I'm trying to implement class inherited singleton as described here (Method 2). Going over the … Read more Python Class Inherited Singleton Inits Instance On Every Call

Why Doesn't The Namedtuple Module Use A Metaclass To Create Nt Class Objects?

I spent some time investigating the collections.namedtuple module a few weeks ago. The module uses … Read more Why Doesn't The Namedtuple Module Use A Metaclass To Create Nt Class Objects?

Can Not Assert Type Of An Object?

Why this source... ''' [...] ''' # Import the standard date and time syst… Read more Can Not Assert Type Of An Object?

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()