Too much code - slicing

Andreas Waldenburger usenot at geekmail.INVALID
Tue Sep 21 12:26:29 EDT 2010


On Sat, 18 Sep 2010 19:09:33 -0700 (PDT) Carl Banks
<pavlovevidence at gmail.com> wrote:

> On Sep 17, 1:01 pm, Andreas Waldenburger <use... at geekmail.INVALID>
> wrote:
> > On Thu, 16 Sep 2010 16:20:33 -0400 AK <andrei.... 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.
> 
> I don't know if it'll ever look good, per se, but it looks better when
> it's used in rule-exception sort of case:
> 
>     something = rule if condition else exception
> 
Spot on. I (more or less) like it when used that way, too. But it seems
to invite crackers like the example above, and that irks me.

/W

-- 
INVALID? DE!




More information about the Python-list mailing list