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


Groups > comp.lang.python > #81700

Re: Iterate over text file, discarding some lines via context manager

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: Iterate over text file, discarding some lines via context manager
Date Fri, 28 Nov 2014 20:04:49 +0200
Organization A noiseless patient Spider
Lines 11
Message-ID <87bnnrdwvy.fsf@elektro.pacujo.net> (permalink)
References <mailman.16405.1417187079.18130.python-list@python.org> <5478ab81$0$2879$426a34cc@news.free.fr> <mailman.16414.1417196454.18130.python-list@python.org> <87fvd3dxb7.fsf@elektro.pacujo.net> <mailman.16415.1417197764.18130.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="725"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yEjmiI8k5ePW4xP0iIfCi"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:k0XM0a4YAogBHIRqW9aUcGCcU+s= sha1:B6d7jhofvCVPAVEg8buiaaLvJLQ=
Xref csiph.com comp.lang.python:81700

Show key headers only | View raw


Chris Angelico <rosuav@gmail.com>:

> Since we're so good at it on this list, I will nit-pick: that's not a
> context manager class, that's an iterator class. A context manager has
> __enter__ and __exit__, an iterator has __iter__ (returning self) and
> __next__ (returning or raising StopIteration).

Excellent. Learnings will never end.


Marko

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


Thread

Iterate over text file, discarding some lines via context manager "fetchinson ." <fetchinson@googlemail.com> - 2014-11-28 16:04 +0100
  Re: Iterate over text file, discarding some lines via context manager "ast" <nomail@invalid.com> - 2014-11-28 18:06 +0100
    Re: Iterate over text file, discarding some lines via context manager Dave Angel <davea@davea.name> - 2014-11-28 12:40 -0500
      Re: Iterate over text file, discarding some lines via context manager Marko Rauhamaa <marko@pacujo.net> - 2014-11-28 19:55 +0200
        Re: Iterate over text file, discarding some lines via context manager Chris Angelico <rosuav@gmail.com> - 2014-11-29 05:02 +1100
          Re: Iterate over text file, discarding some lines via context manager Marko Rauhamaa <marko@pacujo.net> - 2014-11-28 20:04 +0200

csiph-web