* Cantinho Satkeys

Refresh History
  • j.s.: try65hytr a todos  49E09B4F
    Hoje às 21:01
  • FELISCUNHA: ghyt74  pessoal  4tj97u<z
    26 de Janeiro de 2026, 11:00
  • espioca: avast vpn
    26 de Janeiro de 2026, 06:27
  • j.s.: dgtgtr  todos  49E09B4F
    25 de Janeiro de 2026, 15:36
  • Radio TugaNet: Bom Dia Gente Boa
    25 de Janeiro de 2026, 10:18
  • FELISCUNHA: dgtgtr   49E09B4F  e bom fim de semana  4tj97u<z
    24 de Janeiro de 2026, 12:15
  • Cocanate: J]a esta no Forun
    24 de Janeiro de 2026, 01:54
  • Cocanate: Eu tenho
    24 de Janeiro de 2026, 01:46
  • Cocanate: boas minha gente
    24 de Janeiro de 2026, 01:26
  • joca34: BOM DIA AL TEM ESTE CD Star Music - A Minha prima Palmira
    23 de Janeiro de 2026, 15:23
  • joca34: OLA
    23 de Janeiro de 2026, 15:23
  • FELISCUNHA: Bom dia pessoal  4tj97u<z
    23 de Janeiro de 2026, 10:59
  • JPratas: try65hytr Pessoal  4tj97u<z 2dgh8i k7y8j0 classic
    23 de Janeiro de 2026, 05:16
  • j.s.: try65hytr a todos  49E09B4F
    20 de Janeiro de 2026, 18:15
  • FELISCUNHA: ghyt74  pessoal   49E09B4F
    20 de Janeiro de 2026, 11:07
  • j.s.: dgtgtr a todos  49E09B4F
    18 de Janeiro de 2026, 16:02
  • FELISCUNHA: ghyt74   49E09B4F  e bom fim de semana  4tj97u<z
    17 de Janeiro de 2026, 11:18
  • JPratas: try65hytr Pessoal  2dgh8i k7y8j0 yu7gh8
    16 de Janeiro de 2026, 04:50
  • j.s.: try65hytr a todos  49E09B4F 49E09B4F
    15 de Janeiro de 2026, 19:29
  • FELISCUNHA: ghyt74  pessoal   49E09B4F
    15 de Janeiro de 2026, 11:51

Autor Tópico: Comparing Python Objects the Right Way: "is" vs "=="  (Lida 206 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline mitsumi

  • Sub-Administrador
  • ****
  • Mensagens: 129146
  • Karma: +0/-0
Comparing Python Objects the Right Way: "is" vs "=="
« em: 15 de Junho de 2021, 09:04 »

MP4 | Video: h264, 1920x1080 | Audio: AAC, 44.1 KHz, 2 Ch
Genre: eLearning | Language: English | Duration: 5 Lessons (28m) | Size: 75.1 MB

There's a subtle difference between the Python identity operator (is) and the equality operator (==). Your code can run fine when you use the Python is operator to compare numbers, until it suddenly doesn't. You might have heard somewhere that the Python is operator is faster than the == operator, or you may feel that it looks more Pythonic. However, it's crucial to keep in mind that these operators don't behave quite the same.

The == operator compares the value or equality of two objects, whereas the Python is operator checks whether two variables point to the same object in memory. In the vast majority of cases, this means you should use the equality operators == and !=, except when you're comparing to None.

In this course, you'll learn:

What the difference is between object equality and identity
When to use equality and identity operators to compare objects
What these Python operators do under the hood
Why using is and is not to compare values leads to unexpected behavior
How to write a custom __eq__() class method to define equality operator behavior


Download link:
Só visivel para registados e com resposta ao tópico.

Only visible to registered and with a reply to the topic.

Links are Interchangeable - No Password - Single Extraction