Existence from the viewpoint of Python

What is identical to itself exists, otherwise not.

Pythonic Zen:

world = [0, 1, 2, 3, float("nan")]
[x for x in world if x == x]

Result:

[0, 1, 2, 3]

Explanation

According to IEEE754 (or PEP754),

\forall X, NaN != X.

Thus Nan != Nan.

See also

Recommended Posts

Existence from the viewpoint of Python
Learning notes from the beginning of Python 1
Check the existence of the file with python
Learning notes from the beginning of Python 2
the zen of Python
Towards the retirement of Python2
About the ease of Python
About the features of Python
The Power of Pandas: Python
The wall of changing the Django service from Python 2.7 to Python 3
Learn Nim with Python (from the beginning of the year).
[Python] Get the text of the law from the e-GOV Law API
Study from the beginning of Python Hour1: Hello World
Get the return code of the Python script from bat
Python points from the perspective of a C programmer
Study from the beginning of Python Hour8: Using packages
The story of Python and the story of NaN
[Python] The stumbling block of import
First Python 3 ~ The beginning of repetition ~
Different from the import type of python. from A import B meaning
pyenv-change the python version of virtualenv
Change the Python version of Homebrew
[Python] Understanding the potential_field_planning of Python Robotics
Review of the basics of Python (FizzBuzz)
Use the Flickr API from Python
What beginners learned from the basics of variables in python
About the basics list of Python basics
Learn the basics of Python ① Beginners
How to determine the existence of a selenium element in Python
[Python] Try to graph from the image of Ring Fit [OCR]
[Python] Get the update date of a news article from HTML
From the introduction of JUMAN ++ to morphological analysis of Japanese with Python
Important unit seen from the Python lecture materials of Kyoto University
List of disaster dispatches from the Sapporo City Fire Department [Python]
Change the length of Python csv strings
Check the behavior of destructor in Python
[Python3] Understand the basics of Beautiful Soup
Pass the path of the imported python module
The story of making Python an exe
About the virtual environment of python version 3.7
Omit BOM from the beginning of the string
[Python] Understand the content of error messages
[Python3] Rewrite the code object of the function
I didn't know the basics of Python
The result of installing python in Anaconda
[Python] Try pydash of the Python version of lodash
[python] Checking the memory consumption of variables
Check the path of the Python imported module
The story of manipulating python global variables
[python] [meta] Is the type of python a type?
The basics of running NoxPlayer in Python
Launch the Python interpreter from Git bash
Pandas of the beginner, by the beginner, for the beginner [Python]
The Python project template I think of.
In search of the fastest FizzBuzz in Python
Python Basic Course (at the end of 15)
From Python 3.4, pip becomes the standard installer! ??
Set the process name of the Python program
[Python] Get the character code of the file
The story of blackjack A processing (python)
Intuitively learn the reshape of Python np