In article <[EMAIL PROTECTED]>,
Paddy <[EMAIL PROTECTED]> wrote:
>
>John Machin wrote:
>> On 2/06/2006 8:36 AM, Paddy wrote:
>
>>
>> Oh the siren call of every new feature in the language!
>> enumerate() just to get a first-time test, and then botch it??
>>
>> Read the following; the replacement version uses a simple old-fashioned
>> inelegant flag, works with an empty sequence, and doesn't depend on the
>> input being sliceable or indexable.
>>
>> HTH,
>> John
>>
>
>Thanks, un-botchable John. What if the poster doesn't send a null list?
>What if the correct result for a null list is "spam"; or an exception?
>What if.... ... we toned down the language?

I'd still rate Ben Cartwright's solution as the best. The one I posted
tried to do the same, but I didn't see the right way to iterate over
the supplied list inside the function, wheras he did. It's short,
simple and correct.

If you really wanted to return 'spam' or an exception in his solution,
it's a simple if statement at the start of the function.




-- 
Jim Segrave           ([EMAIL PROTECTED])

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

Reply via email to