Message11069

Author jeff.allen
Recipients jeff.allen, stefan.richthofer, wymannmi, zyasoft
Date 2017-02-02.19:44:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486064650.19.0.156057061926.issue2521@psf.upfronthosting.co.za>
In-reply-to
Content
Actually I'm warming to this.

The question of symmetry in == popped into my head later in the day too. In fact it works because str does not know what to do with your object and __eq__ is its own reverse. With obvious definitions, one can demonstrate it in pure Python (on Jython 2.7.0, of course).

>>> sys.platform = Multi('win32', 'java')
>>> sys.platform == 'java'
True
>>> 'java' == sys.platform
True
>>> sys.platform.startswith('win')
True
>>> sys.platform
Multi(set(['win32', 'java']))
>>>

Python: can't help but smile some days.

I guess this magical string should be unhashable, in case it ended up as a key in a dictionary?
History
Date User Action Args
2017-02-02 19:44:10jeff.allensetmessageid: <1486064650.19.0.156057061926.issue2521@psf.upfronthosting.co.za>
2017-02-02 19:44:10jeff.allensetrecipients: + jeff.allen, zyasoft, stefan.richthofer, wymannmi
2017-02-02 19:44:10jeff.allenlinkissue2521 messages
2017-02-02 19:44:09jeff.allencreate