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


Groups > comp.lang.python > #93025

Re: Simplest/Idiomatic way to count files in a directory (using pathlib)

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: Simplest/Idiomatic way to count files in a directory (using pathlib)
Date Mon, 22 Jun 2015 18:32:52 -0700
Organization A noiseless patient Spider
Lines 6
Message-ID <87k2uvjjjv.fsf@nightsong.com> (permalink)
References <mailman.712.1435012328.13271.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="f03d25f67b6a57154c811e0f718cc0da"; logging-data="10137"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YpSZDn0zF2zGBhgj7LW8n"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:97owXTBkRHmDOn7YQ51XREzD7Zk= sha1:DmdtISm5q0lj+KRaeoONLreIa6w=
Xref csiph.com comp.lang.python:93025

Show key headers only | View raw


Travis Griggs <travisgriggs@gmail.com> writes:
> The following seems to obtuse/clever for its own good:
>     return sum(1 for _ in self.path.iterdir())

I've generally done something like that.  I suppose it could be added to
itertools.

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


Thread

Simplest/Idiomatic way to count files in a directory (using pathlib) Travis Griggs <travisgriggs@gmail.com> - 2015-06-22 15:31 -0700
  Re: Simplest/Idiomatic way to count files in a directory (using pathlib) Paul Rubin <no.email@nospam.invalid> - 2015-06-22 18:32 -0700
    Re: Simplest/Idiomatic way to count files in a directory (using pathlib) Terry Reedy <tjreedy@udel.edu> - 2015-06-23 12:17 -0400

csiph-web