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


Groups > comp.lang.python > #85947

Re: What behavior would you expect?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jsf80238@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.040
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'skip:[ 20': 0.04; 'subject:would': 0.07; 'def': 0.12; 'descending': 0.16; 'os.getcwd()': 0.16; 'modification': 0.16; 'ignore': 0.16; 'value.': 0.19; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'guess': 0.33; 'to:name :python-list': 0.33; 'comment': 0.34; 'received:google.com': 0.35; 'really': 0.36; 'returning': 0.36; 'subject:?': 0.36; 'should': 0.36; 'list': 0.37; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'list,': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'full': 0.61; 'such': 0.63; 'subject:you': 0.87
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wwmY0DHg1My8GVbrCmF1+rb9amUlf6sqo05WB+StAik=; b=x9bpi9jDCC0n0PvY6kOQt1PVSiMubEdnNxTH7KR+f2LAsTOIPr4L8q4dhom4r0sEm9 9UFLKawBGTMZLmp7xOz7vHZjoDa5Z5SV5uKBvgRGmhm9Emeb3UoP9BuGubBT7GNdrfBI 4F02nvKnUXrFm3WS3HMw4IcKDegQDDGoO9p1i8DJX3m7bmoFP3i20OBZMvjTpaC89U6Q 9HSIQZZtQlucP7gBf23ELXnmkU0czkMBtt+7L0EGSaYDglG2zITYPGG3NmlYEfpo6UYj IEdBl4gHLzOwFd1nog8003xwvfQ+okWlvDL5tXWnb5Su2EFPIEFjiZrxEAg1sdjuhcGw UB5Q==
MIME-Version 1.0
X-Received by 10.194.109.9 with SMTP id ho9mr14631043wjb.29.1424409709858; Thu, 19 Feb 2015 21:21:49 -0800 (PST)
In-Reply-To <CANy1k1gMgGnqNcgTwjcqfYH-QctZthv89uXcU8SV9Uk6Wji=4A@mail.gmail.com>
References <CANy1k1g+wU6VUifZpV5+DWendT2LqS-PhRA-KC5hmq2xQ_uy+A@mail.gmail.com> <CANy1k1gMgGnqNcgTwjcqfYH-QctZthv89uXcU8SV9Uk6Wji=4A@mail.gmail.com>
Date Thu, 19 Feb 2015 22:21:49 -0700
Subject Re: What behavior would you expect?
From Jason Friedman <jsf80238@gmail.com>
To python-list <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7bf10a12c557c7050f7e3ab4
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18910.1424409716.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1424409716 news.xs4all.nl 2857 [2001:888:2000:d::a6]:45996
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85947

Show key headers only | View raw


[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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web