1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python pickled object equality guarantees

Discussão em 'Python' iniciado por Stack, Maio 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am wondering if, and if so which guarantees there are about the pickle module when using pickle.dump.

    Specifically for my problem I am pickling list[T] where T can be bool, int, decimal, time, date, datetime, timedelta or str, so the list is homogeneous (one type per list). I wonder if it is guaranteed that lists that would be equal in python are also guaranteed to have the same pickled result, at least for the types given.

    I couldn't find any guarantees online, but from some basic testing I couldn't find a case where the data would be different.

    So TL;DR:

    Given two list[T] where T is bool | int | decimal | time | date | datetime | timedelta | str that are equal in python, will the resulting pickle.dump() objects also be equal?

    Continue reading...

Compartilhe esta Página