[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] python: simplify complicated conditional assignment



At Thu, 22 Aug 2013 09:55:08 +0200,
Claudio Bley wrote:
> 
> At Wed, 21 Aug 2013 10:24:16 -0600,
> Eric Blake wrote:
> > 
> > On 08/21/2013 08:05 AM, Claudio Bley wrote:
> > > 
> > > Signed-off-by: Claudio Bley <cbley av-test de>
> > > ---
> > > Just noticed this while reading the generated .py files.
> > > 
> > > Might save a few cycles eventually...
> > > 
> > >  python/generator.py |    3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > ACK.
> 
> Thanks.
> 
> But, I was still thinking about a possible case where doing the
> assignment in this way was necessary or useful.
> 
> In the case if someone actually overwrites the __ne__ operator
> of a class in some strange way:
> 
> def __ne__(self, other):
>   if other is None:
>     return False
>   else:
>     return NotImplemented
> 
> (and __eq__ likewise), such that the instance would compare equal to
> None, the semantic of the codes would differ.
> 
> IMO, we don't need to care if someone chooses to implement such
> awkward equality rules. In the end, (s)he could directly pass None as
> an argument if None is what is inteded. So, I'm going to push this if
> nobody objects in the next few hours.

Pushed now.

Claudio
-- 
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>

Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]