On Jan 3, 4:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Dec 29 2007, 11:10 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > I'm considering deprecating these two functions and would like some > > feedback from the community or from people who have a background in > > functional programming. > > Well I have just this minute used dropwhile in anger, to find the next > suitable filename when writing database dumps using date.count names: > > filename = "%02d-%02d-%d" % (now.day, now.month, now.year) > if os.path.exists(filename): > candidates = ("%s.%d" % (filename, x) for x in count(1)) > filename = dropwhile(os.path.exists, candidates).next() > > Much clearer than the alternatives I think, please keep dropwhile and > takewhile in itertools ;)
Wouldn't using ifilterfalse instead of dropwhile produce the same result? -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list