In types — Dynamic type creation and names for built-in types — Python 3.14.3 documentation , it says:
class types.CodeType(**kwargs )
The (**kwargs) is surely there by mistake?
In types — Dynamic type creation and names for built-in types — Python 3.14.3 documentation , it says:
class types.CodeType(**kwargs )
The (**kwargs) is surely there by mistake?
No, it is not a glitch. The constructor accepts keyword arguments, but it is not specified what arguments, because creating a code object dorectly is not recommended.
The documentation needs more love.
To me, saying that types.CodeType(**kwargs) is “the type of code objects” suggests that it is a function returning a type.
Especially in contradistinction to all the other standard interpreter types surrounding it.
It is a “glitch”. Whatever convention is being used should be the same between FunctionType and CodeType. (Also, they are documented, just elsewhere.)
The page in general is very inconsistent in what is called a class and what is just a generic value.
Can someone please move this out of the translations section to the general docs one?