Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52341 > unrolled thread

Re: Python Basic Doubt

Started byTerry Reedy <tjreedy@udel.edu>
First post2013-08-10 21:25 -0400
Last post2013-08-10 21:25 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python Basic Doubt Terry Reedy <tjreedy@udel.edu> - 2013-08-10 21:25 -0400

#52341 — Re: Python Basic Doubt

FromTerry Reedy <tjreedy@udel.edu>
Date2013-08-10 21:25 -0400
SubjectRe: Python Basic Doubt
Message-ID<mailman.449.1376184354.1251.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web