Stackoverflow question: Is there a built-in identity function in Python?

Ben Finney ben+python at benfinney.id.au
Thu Dec 7 18:43:28 EST 2017


Nathan Ernst <nathan.ernst at gmail.com> writes:

> There is a built-in identity function in Python. The function is called
> 'id'.

It should be clear from the rest of the thread. But, to be explicit:
That's not what is meant by “identity function”, and the Python ‘id’
function is not an identity function.

The Python ‘id’ function returns the “identity of the object”, a
Python-specific concept that is unrelated to the identity function.

An “identity function” is mathematics terminology for “a function that
always returns the same value that was used as its argument.”
<URL:https://en.wikipedia.org/wiki/Identity_function>

-- 
 \       “But Marge, what if we chose the wrong religion? Each week we |
  `\          just make God madder and madder.” —Homer, _The Simpsons_ |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list