[PATCH 0/4] Speed improvement in fetch/clone

Robert Collins robertc at robertcollins.net
Sun Jan 22 21:39:21 GMT 2006


On Thu, 2006-01-19 at 01:56 -0800, Robey Pointer wrote:
> On 18 Jan 2006, at 13:52, Goffredo Baroncelli wrote:
> 
> > +        pb = pb and pb or bzrlib.ui.ui_factory.progress_bar()
> 
> I wanna give a -1 to this line.  This construction (x and y or z) and  
> its pitfalls is actually the reason the ternary operator was added to  
> python 2.5 and even after long discussions about what it means, I  
> *still* find it confusing.
> 
> A 4-line if/else will cost you screen real estate but win you the  
> love of your fellow man. :)

pb = pb or bzrlib.ui.ui_factory.progress_bar()

will work correctly and is IMO quite readable. (the pb and pb clause is
completely unneeded as you say).

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060123/ab074830/attachment.pgp 


More information about the bazaar mailing list