Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52341
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Python Basic Doubt |
| Date | 2013-08-10 21:25 -0400 |
| References | (1 earlier) <20130810114040.6ac78fe8@bigbox.christie.dr> <52067FDA.2030908@gmail.com> <5206B527.6080700@islandtraining.com> <CAPTjJmoM=MU2eqa2i_5_RbveXMqScQqu_uFjonwdrZX7Vsc49g@mail.gmail.com> <5206DDED.8030506@islandtraining.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.449.1376184354.1251.python-list@python.org> (permalink) |
On 8/10/2013 8:42 PM, Gary Herron wrote:
> But for each of your examples, using "==" is equivalent to using "is".
> Each of
> if something == None
> if device == _not passed
> if device != None
> would all work as expected. In none of those cases is "is" actually
> needed.
class EqualAll:
def __eq__(self, other): return True
ea = EqualAll()
print(ea == None)
print(ea == float('nan'))
>>>
True
True
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python Basic Doubt Terry Reedy <tjreedy@udel.edu> - 2013-08-10 21:25 -0400
csiph-web