Skip to content

Tag: cpython

How are small sets stored in memory?

If we look at the resize behavior for sets under 50k elements: This pattern is consistent with quadrupling of the backing storage size once the set is 3/5ths full, plus some presumably constant overhead for the PySetObject: A similar pattern continues even for larger sets, but the resize factor switches to do…

Rocksdb undefined symbol: ZSTD_versionNumber Cpython

I am using python 3.6, and RocksDB is installed in the container by following command: It looks like a version issue for me. Not sure how to resolve it. Tried add rocksdb and python-rocksdb to the requirement file. But not work either. The service was working before. However, the last working docker container…

How does Python’s reversed() function work?

According to Python’s docs, reversed() uses __getitem__ and __len__ if __reversed__ is not implemented. I’ve encountered a weird behavior and failed to explain it: Although calling reversed() on mapping types makes no sense, how does it know it’s a mapping? Does it internally check isinstanc…