Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

352
Visualizações
Is object() == object() guaranteed to be False?

Suppose I create two instances of class object. Are these two instances guaranteed to be not equal to each other? In other words, is object() == object() guaranteed to be False, or is it implementation-dependent?

I understand that object() is object() is guaranteed to be False, but here I am asking about object() == object().

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Yes it is guaranteed that object() == object() is False because it is documented that "by default, object implements __eq__() by using is".

over 4 years ago · Santiago Trujillo Relatório

0

Each Python 3.x release is intended to be backward-compatible with previous 3.x releases. As it's the base class, changing the comparison behavior of object would break this backward compatibility promise. So I think you can rely on it, but if we knew what you're trying to do that requires this invariant, we could probably give better advice.

You can always use assert to make sure it continues to be true.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda