Re: Finding the first index in a list greater than a particular value

2016-08-15 Thread Michael Selik
On Mon, Aug 15, 2016 at 2:01 AM Jussi Piitulainen < jussi.piitulai...@helsinki.fi> wrote: > There is a tradition of returning -1 when no valid index is found. > Sometimes it's better to break with tradition. Raise a ValueError. No silent errors, and all that Zen. -- https://mail.python.org/mailm

Re: Finding the first index in a list greater than a particular value

2016-08-14 Thread Jussi Piitulainen
Atri Mahapatra writes: > I have a list of dictionaries which look like this: > [{'Width': 100, 'Length': 20.0, 'Object': 'Object1'}, {'Width': 12.0, > 'Length': 40.0, 'Object': 'Object2'}.. so on till 10] > > I would like to find the first index in the list of dictionaries whose > length is

Re: Finding the first index in a list greater than a particular value

2016-08-14 Thread Michael Selik
On Sun, Aug 14, 2016 at 2:21 PM Atri Mahapatra wrote: > I have a list of dictionaries which look like this: > [{'Width': 100, 'Length': 20.0, 'Object': 'Object1'}, {'Width': 12.0, > 'Length': 40.0, 'Object': 'Object2'}.. so on till 10] > > I would like to find the first index in the list of d

Re: Finding the first index in a list greater than a particular value

2016-08-14 Thread MRAB
On 2016-08-14 19:40, Atri Mahapatra wrote: On Monday, 15 August 2016 00:03:59 UTC+5:30, MRAB wrote: On 2016-08-14 19:17, Atri Mahapatra wrote: > I have a list of dictionaries which look like this: > [{'Width': 100, 'Length': 20.0, 'Object': 'Object1'}, {'Width': 12.0, 'Length': 40.0, 'Object':

Re: Finding the first index in a list greater than a particular value

2016-08-14 Thread Atri Mahapatra
On Monday, 15 August 2016 00:03:59 UTC+5:30, MRAB wrote: > On 2016-08-14 19:17, Atri Mahapatra wrote: > > I have a list of dictionaries which look like this: > > [{'Width': 100, 'Length': 20.0, 'Object': 'Object1'}, {'Width': 12.0, > > 'Length': 40.0, 'Object': 'Object2'}.. so on till 10] > >

Re: Finding the first index in a list greater than a particular value

2016-08-14 Thread MRAB
On 2016-08-14 19:17, Atri Mahapatra wrote: I have a list of dictionaries which look like this: [{'Width': 100, 'Length': 20.0, 'Object': 'Object1'}, {'Width': 12.0, 'Length': 40.0, 'Object': 'Object2'}.. so on till 10] I would like to find the first index in the list of dictionaries whose l