[Python-ideas] Keyword/Symbol literals

Yawar Amin yawar.amin at gmail.com
Wed Jan 21 17:18:36 CET 2015


Hi,

On 2015-01-21, at 0:20, Matthew Rocklin <mrocklin at gmail.com> wrote:

> [...]
> 
> What do people do now?

Currently I use new empty types as symbols. E.g.:

class my_symbol: pass
x = my_symbol

if x == my_symbol: print("yes")

Probably there's a nicer way to do it, but the advantage of using types is they are obviously interned.

Regards,

Yawar

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150121/56e27764/attachment.html>


More information about the Python-ideas mailing list