[Checkins] [zopefoundation/zope.ramcache] 317530: Use an object with __slots__ instead of a list for...

GitHub noreply at github.com
Mon Aug 21 18:55:28 CEST 2017


  Branch: refs/heads/named-attrs
  Home:   https://github.com/zopefoundation/zope.ramcache
  Commit: 31753038434e2100d7455fa7fff37fe5f7acb353
      https://github.com/zopefoundation/zope.ramcache/commit/31753038434e2100d7455fa7fff37fe5f7acb353
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2017-08-21 (Mon, 21 Aug 2017)

  Changed paths:
    M CHANGES.rst
    M src/zope/ramcache/ram.py
    M src/zope/ramcache/tests/test_ramcache.py

  Log Message:
  -----------
  Use an object with __slots__ instead of a list for data storage.

This is smaller than a 3-item list on all checked versions of Python.

It has the same access time for indexes versus attributes on all
checked versions of Python.

It may be somewhat slower to initially construct (its hard to
benchmark list construction because of the internal list cache).

The primary reason to use it though, is code readability.




More information about the checkins mailing list