Pattern Search Regular Expression

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Jun 15 10:28:44 EDT 2013


On 15/06/2013 14:45, Denis McMahon wrote:
> On Sat, 15 Jun 2013 13:41:21 +0000, Denis McMahon wrote:
>
>> first_and_last = [sentence.split()[i] for i in (0, -1)] middle =
>> sentence.split()[1:-2]
>
> Bugger! That last is actually:
>
> sentence.split()[1:-1]
>
> It just looks like a two.
>

I've a very strong sense of deja vu having round the same loop what, two 
hours ago?  Wondering out aloud the number of times a programmer has 
thought "That's easy, I don't need to test it".  How are the mighty fallen.

-- 
"Steve is going for the pink ball - and for those of you who are 
watching in black and white, the pink is next to the green." Snooker 
commentator 'Whispering' Ted Lowe.

Mark Lawrence




More information about the Python-list mailing list