Il giorno lun 13 gen 2020 alle ore 09:09 Giovanni Porcari <giovanni.porc...@softwell.it> ha scritto: > > Marco ho fatto una prova che non mi riesco a spiegare: tu ne hai una ragione ? > > (python 3.7.5) > >> a='xy' > >>> b='xy' > >>> a is b > True > > >>> a='x y' > >>> b='x y' > >>> a is b > False > > >>> a='x_y' > >>> b='x_y' > >>> a is b > True > >>> > > Hai spiegazioni ?
Se la stringa segue le regole sintattiche di un identificatore, viene intern()ata automaticamente. ``` >>> import sys >>> a = sys.intern("a b") >>> b = sys.intern("a b") >>> a is b True ``` 👋 ㎝ -- !!!! THE 🍺-WARE LICENSE (Revision ㊷): <㎝@🐍.it> wrote this 📧. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a 🍺 in return. — ㎝ _______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python