Re: [Python-ideas] Allow callables in slices

2018-06-09 Thread Michael Selik
On Sat, Jun 9, 2018 at 6:28 AM Michel Desmoulin wrote: > Example, open this files, load all lines in memory, skip the first line, > then get all the line until the first comment: > > import itertools > > def is_commented(line): > return lines.startwith('#') > > def lines(): >

Re: [Python-ideas] Allow callables in slices

2018-06-09 Thread Michel Desmoulin
Le 09/06/2018 à 11:47, Steven D'Aprano a écrit : > On Sat, Jun 09, 2018 at 11:17:05AM +0200, Michel Desmoulin wrote: >> Such as that: >> >> def starting_when(element): >> ... >> >> a_list[starting_when:] > >> Is equivalent to: > [...] >> list(dropwhile(lambda x: not