[Python-ideas] Add new `Symbol` type

Flavio Curella flavio.curella at gmail.com
Thu Jul 5 15:38:47 EDT 2018


More than once I've found myself wanting to create a 'sentinel' value. The
most common use case is to differentiate between an argument that has not
been provided, and an argument provided with the value `None`.

This would be solvable by implementing something similar to what JavaScript
calls [`Symbol`](
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
).

This could be implemented as a 3rd-party library, but there won't be a way
to have ['Global' Symbols](
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/for
)

Furthermore, without a common implementation in the std library, various
Python libraries had to write their own implementations, which all differs
in functionality and behavior.

Is this something that the Python community is interested in? I'm willing
to write the PEP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180705/7eae01e2/attachment.html>


More information about the Python-ideas mailing list