Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Python 2.7.3 (default, Jun 18 2012, 17:45:15)
- [GCC 4.5.3] on linux2
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import sys
- >>> import collections
- >>> point = collections.namedtuple('Point',['x','y'])
- >>> class PointClass(object):
- ... __slots__=['x','y']
- ...
- >>> sys.getsizeof(point)
- 904
- >>> sys.getsizeof(PointClass)
- 904
- >>> inst1 = point(x=1,y=2)
- >>> inst2 = PointClass()
- >>> inst2.x = 1
- >>> inst2.y = 2
- >>> sys.getsizeof(inst1)
- 72
- >>> sys.getsizeof(inst2)
- 64
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement