3 ms·
Using __slots__ is not really the same as using a namedtuple, because namedtuples are immutable.
by pmiller2 13y ago
Using __slots__ is not really the same as using a namedtuple, because namedtuples are immutable.
- burntsushi 13y agoThe OP didn't say it was the same. It said they were similar. And they certainly are. Although, there may be performance differences between `namedtuple` and `__slots__`. Particularly access time. This SO post elaborates.[1] [1] - http://stackoverflow.com/questions/2646157/what-is-the-fastest-to-access-struct-like-object-in-python http://stackoverflow.com/questions/2646157/what-is-the-faste...