Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Steven D'Aprano
Wait, I have another comment... On Wed, Oct 28, 2015 at 02:48:05PM +, Flynn, Stephen (L & P - IT) wrote: > I'm iterating through a list and I'd like to know when I'm at > the end of the said list, so I can do something different. For example [...] > For context, I'm working my way throu

Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Steven D'Aprano
On Wed, Oct 28, 2015 at 02:48:05PM +, Flynn, Stephen (L & P - IT) wrote: > I'm iterating through a list and I'd like to know when I'm at > the end of the said list, so I can do something different. For example > > list_of_things = ['some', 'special', 'things'] > for each_entry in list_o

Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Cameron Simpson
On 28Oct2015 14:48, Flynn, Stephen (L & P - IT) wrote: Python 3. I'm iterating through a list and I'd like to know when I'm at the end of the said list, so I can do something different. For example list_of_things = ['some', 'special', 'things'] for each_entry in list_of_things

Re: [Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Peter Otten
Flynn, Stephen (L & P - IT) wrote: > Afternoon, > > Python 3. > > I'm iterating through a list and I'd like to know when I'm at > the end of the said list, so I can do something different. For example > > list_of_things = ['some', 'special', 'things'] > for each_entry in list_of_things: > print

[Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Flynn, Stephen (L & P - IT)
Afternoon, Python 3. I'm iterating through a list and I'd like to know when I'm at the end of the said list, so I can do something different. For example list_of_things = ['some', 'special', 'things'] for each_entry in list_of_things: print(each_entry) if each_ent