is implemented with id ?

Ramchandra Apte maniandram01 at gmail.com
Thu Sep 6 09:30:13 EDT 2012


On Thursday, 6 September 2012 17:46:38 UTC+5:30, Roy Smith  wrote:
> In article <50484643$0$29977$c3e8da3$5496439d at news.astraweb.com>,
> 
>  Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
> 
> 
> 
> > On Wed, 05 Sep 2012 14:27:44 -0400, Terry Reedy wrote:
> 
> > 
> 
> > > On 9/5/2012 8:48 AM, Ramchandra Apte wrote:
> 
> > > 
> 
> > >  > and "a==True" should be automatically changed into memory comparison.
> 
> > > 
> 
> > > I have no idea what that means.
> 
> > 
> 
> > I interpret this as meaning that "a == True" should be special-cased by 
> 
> > the interpreter as "a is True" instead of calling a.__eq__.
> 
> 
> 
> That would break classes which provide their own __eq__() method.

There is a way of doing this: make True.__req__ = lambda other: self is other



More information about the Python-list mailing list