Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85947 > unrolled thread

Re: What behavior would you expect?

Started byJason Friedman <jsf80238@gmail.com>
First post2015-02-19 22:21 -0700
Last post2015-02-19 22:21 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: What behavior would you expect? Jason Friedman <jsf80238@gmail.com> - 2015-02-19 22:21 -0700

#85947 — Re: What behavior would you expect?

FromJason Friedman <jsf80238@gmail.com>
Date2015-02-19 22:21 -0700
SubjectRe: What behavior would you expect?
Message-ID<mailman.18910.1424409716.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

> def order_matching_files(a_path, a_glob="*"):
>     """Search a path for files whose names match a_glob
>     and return a list of the full path to such files, in descending
>     order of modification time. Ignore directories."""
>     previous_dir = os.getcwd()
>     os.chdir(a_path)
>     return_list = [os.path.join(a_path, x) for x in glob.glob(a_glob) if
> os.path.isfile(x)]
>     os.chdir(previous_dir)
>     return reversed(sorted(return_list, key=os.path.getmtime))
>

Oops, guess I'm not really returning a list, I'm returning an iterator.  I
should change either the comment or the return value.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web