I am working with Python's decimal module, but when I do:
>>>from decimal import Decimal
>>>d = Decimal('3.14')
>>>d.__slots__
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'decimal.Decimal' object has no attribute '__slots__'
>>>Decimal.__slots__
raceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: type object 'decimal.Decimal' has no attribute '__slots__'
But when I inspect Decimal
class in PyCharm (_pydecimal.py), I see:
class Decimal(object):
"""Floating point class for decimal arithmetic."""
__slots__ = ('_exp','_int','_sign', '_is_special')
...
Supposedly, I should be able to get __slots__
from class/instance, but I didn't. What am I missing here? (This kinda behaves like Python's built-in int
class.)