Skip to main content

All Questions

Tagged with
0 votes
2 answers
460 views

Dynamically choose whether to use __slots__ in a class

I've got a generic container class: from typing import Container, Generic, TypeVar, NamedTuple import sys fixed_typing = (sys.version_info >= (3, 6, 2) or (3, 5, 3) <= sys....
Eli Korvigo's user avatar
3 votes
2 answers
1k views

Is “A programmer-defined type.” a right definition of "class" in Python?

In Think Python 2e "class" is defined as "A programmer-defined type. A class definition creates a new class object." But isn't a built-in type considered a class too? Using Python 3.4.0, the ...
Mahmood Muhammad Nageeb's user avatar