Too much code - slicing

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Sep 17 21:50:59 EDT 2010


On Fri, 17 Sep 2010 16:01:54 -0400, Andreas Waldenburger wrote:

> On Thu, 16 Sep 2010 16:20:33 -0400 AK <andrei.avk at gmail.com> wrote:
> 
>> I also like this construct that works, I think, since 2.6:
>> 
>> code = dir[int(num):] if side == 'l' else dir[:-1*int(num)]
>> 
> I wonder when this construct will finally start to look good.


It looks good to me. It follows a common English idiom:

"What are you doing tonight?"
"I'll be going to the movies, if I finish work early, otherwise I'll stay 
home and watch a DVD."



-- 
Steven



More information about the Python-list mailing list