> >  c=' abcde abc cba fdsa bcd '.split()
> >  dels='ce '
> >  for j in dels:
> >    cp=[]
> >    for i in xrange(0,len(c)-1):
>
> The "-1" looks like a bug; remember in Python 'stop' bounds
> are exclusive. The indexes of c are simply xrange(len(c)).

Yep. Just found it out, though this seems a bit counterintuitive to
me, even if it makes for more elegant code: I forgot about the high
stop bound.

>From my POV, if I want sequence from here to there, it should include
both here and there.

I do understand the consequences of making high bound exclusive, which
is more elegant code: xrange(len(c)). But it does seem a bit
illogical...

>      print re.split('[ce ]', c)

Yes, that does the job. Thanks.

Regards,
Marcin

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to