> Thanks for the tip on enumerate, escaped me. Much like Kent's simply
> using a temporary var escaped me despite having done similar things
> often... never reply on a tiring Friday. On the bright side this
> blunder with indexes, iterators, and lengths has made me more aware of
> other contexts f
On Sun, Oct 11, 2009 at 4:07 AM, Rich Lovely wrote:
> for i, v in enumerate(x[:-1]): #omitting last value in list to avoid
> IndexError
> print v, x[i+1]
Thanks for the tip on enumerate, escaped me. Much like Kent's simply
using a temporary var escaped me despite having done similar things
of
2009/10/9 Oxymoron :
> On Fri, Oct 9, 2009 at 11:02 PM, Kent Johnson wrote:
>> On Fri, Oct 9, 2009 at 3:54 AM, Stefan Lesicnik wrote:
>>
>> You can easily keep track of the previous item by assigning it to a
>> variable. For example this shows just the increasing elements of a
>> sequence:
>>
>>
On Fri, Oct 9, 2009 at 11:02 PM, Kent Johnson wrote:
> On Fri, Oct 9, 2009 at 3:54 AM, Stefan Lesicnik wrote:
>
> You can easily keep track of the previous item by assigning it to a
> variable. For example this shows just the increasing elements of a
> sequence:
>
> In [22]: items = [0, 1, 3, 2,
On Fri, Oct 9, 2009 at 3:54 AM, Stefan Lesicnik wrote:
> Hi,
>
> This feels like a strange issue, so i hope I formulate this so its
> understandable.
>
> I have some objects. Each object has associated values. I am looping
> through these objects, working with a value and printing out the
> value.
On Fri, Oct 9, 2009 at 9:35 PM, Oxymoron wrote:
> Thus, you can muck around with x[i] (current item), and x[i+1] (next
> item), and decide how you want to proceed with the loop. Note the use
> of len(x) - 1 rather than just len(x) to easily prevent an IndexError
> or extra special case logic.
"ea
Hello,
On Fri, Oct 9, 2009 at 6:54 PM, Stefan Lesicnik wrote:
> The issue in this case is that i need to check if the one value
> superseeds the other, and in that case, not print it out. I think the
> problem is that when you are in the loop, you dont know about the
> other object that you haven
2009/10/9 Stefan Lesicnik
Hi,
>
> This feels like a strange issue, so i hope I formulate this so its
> understandable.
>
> I have some objects. Each object has associated values. I am looping
> through these objects, working with a value and printing out the
> value.
> The issue in this case is t
Hi,
This feels like a strange issue, so i hope I formulate this so its
understandable.
I have some objects. Each object has associated values. I am looping
through these objects, working with a value and printing out the
value.
The issue in this case is that i need to check if the one value
super