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


Groups > comp.lang.python > #85858

What behavior would you expect?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.194
X-Spam-Level *
X-Spam-Evidence '*H*': 0.62; '*S*': 0.01; 'subject:would': 0.07; 'function?': 0.16; 'readable': 0.16; 'feb': 0.22; 'question': 0.24; 'matching': 0.30; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; 'skip:m 30': 0.32; 'to:name:python-list': 0.33; 'received:google.com': 0.35; 'subject:?': 0.36; 'to:addr:python- list': 0.38; 'files': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'most': 0.60; 'name': 0.63; 'such': 0.63; 'timestamps,': 0.84; 'subject:you': 0.87
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=zFg97YusJ3shVCwpi7HwoN/iz3968U5Rxo7IEDUE54g=; b=l/Xt7eW6bLN1hf1xFt8Wmi8ovfty75kIjW5TJplEEnzKbRIlQfSuNQUS1QSch0y5jp PNtR9jvZEf7KROC41uCiiZbDCtMiwg8QbGsOIEuOS7+jsfZw/0kKUpW3oaUhIJ1TZWUd maGc4znzMq1AxjzQNuLW6vsoQt24osKhWorGFwkPdRCu8TGIZS7l7SPnVzmrw36S3iml IoDt8higKLuMzMo/Q5+OYqCTHNuOy8zMcHpU7Y6aURh26EEysgee2X+suMvCEXH3FOGA +cAPpoIQfA9q9DMeXEQlk4L848RYKONdxlHeDmYUO+9yFJ2PZdZP0GNwF1g0CSD73uWp 8MFA==
MIME-Version 1.0
X-Received by 10.180.37.110 with SMTP id x14mr6471300wij.45.1424321052101; Wed, 18 Feb 2015 20:44:12 -0800 (PST)
Date Wed, 18 Feb 2015 21:44:12 -0700
Subject What behavior would you expect?
From Jason Friedman <jsf80238@gmail.com>
To python-list <python-list@python.org>
Content-Type multipart/alternative; boundary=e89a8f6475a95b53d7050f6996f4
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.18856.1424321059.18130.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1424321059 news.xs4all.nl 2932 [2001:888:2000:d::a6]:37424
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85858

Show key headers only | View raw


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

I have need to search a directory and return the name of the most recent
file matching a given pattern.  Given a directory with these files and
timestamps,

q.pattern1.abc Feb 13
r.pattern1.cdf  Feb 12
s.pattern1.efg  Feb 10
t.pattern2.abc Feb 13
u.pattern2.xyz  Feb 14
v.pattern2.efg  Feb 10

calling my_function("/path/to/dir", "pattern1") will return q.pattern1.abc
and calling my_function("/path/to/dir", "pattern2") will return
u.pattern2.xyz.

My question is, what would be a reasonable behavior/result/return value if:
1. "/path/to/dir" does not exist or is not readable
2. no files match the given pattern

Also, what would be a reasonable name for such a function?

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


Thread

What behavior would you expect? Jason Friedman <jsf80238@gmail.com> - 2015-02-18 21:44 -0700
  Re: What behavior would you expect? Denis McMahon <denismfmcmahon@gmail.com> - 2015-02-19 14:16 +0000
    Re: What behavior would you expect? Chris Angelico <rosuav@gmail.com> - 2015-02-20 02:08 +1100
      Re: What behavior would you expect? Denis McMahon <denismfmcmahon@gmail.com> - 2015-02-19 20:03 +0000
        Re: What behavior would you expect? Chris Angelico <rosuav@gmail.com> - 2015-02-20 07:11 +1100
          Re: What behavior would you expect? Dan Sommers <dan@tombstonezero.net> - 2015-02-20 04:54 +0000
            Re: What behavior would you expect? Chris Angelico <rosuav@gmail.com> - 2015-02-20 16:16 +1100
              Re: What behavior would you expect? Dan Sommers <dan@tombstonezero.net> - 2015-02-20 05:40 +0000
                Re: What behavior would you expect? Jason Friedman <jsf80238@gmail.com> - 2015-02-19 22:49 -0700
                Re: What behavior would you expect? Paul Rubin <no.email@nospam.invalid> - 2015-02-19 22:18 -0800
                Re: What behavior would you expect? Chris Angelico <rosuav@gmail.com> - 2015-02-20 17:21 +1100
                Re: What behavior would you expect? Paul Rubin <no.email@nospam.invalid> - 2015-02-19 23:18 -0800

csiph-web