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


Groups > comp.lang.python > #33373

Re: Python garbage collector/memory manager behaving strangely

Path csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'subject:Python': 0.05; 'line:': 0.07; 'namespace': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.10; '(aahz)': 0.16; 'email addr:pythoncraft.com': 0.16; 'email name:aahz': 0.16; 'justified': 0.16; 'len(line)': 0.16; 'programmer,': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'else,': 0.17; 'yield': 0.17; '>>>': 0.18; 'module': 0.19; '(not': 0.20; 'changes': 0.20; 'either.': 0.22; "i'd": 0.22; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'lines': 0.28; 'subject:/': 0.28; '>>>>': 0.29; 'writes:': 0.29; "skip:' 10": 0.30; 'function': 0.30; 'to:addr:python-list': 0.33; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'charset:us- ascii': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'you.': 0.61; 'received:217': 0.68; 'actually,': 0.84; 'confusing': 0.84; 'mistake': 0.91; 'shadow': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dieter Maurer <dieter@handshake.de>
Subject Re: Python garbage collector/memory manager behaving strangely
Date Thu, 15 Nov 2012 08:31:15 +0100
References <CEE8C35195DB944D9C75ABB15A04193B14E77085@EHKG17P32001A.csfb.cs-group.com> <59f8c664-8f11-439e-8002-ca76ee24a632@g7g2000pbh.googlegroups.com> <mailman.830.1347878839.27098.python-list@python.org> <50570de3$0$29981$c3e8da3$5496439d@news.astraweb.com> <k8098p$b2e$1@panix5.panix.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e092b8.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:K/2jxLnH6PQwDLrq91FM0dB2pYA=
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3711.1352964690.27098.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352964690 news.xs4all.nl 6845 [2001:888:2000:d::a6]:38169
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33373

Show key headers only | View raw


aahz@pythoncraft.com (Aahz) writes:

> ...
>>>>     def readlines(f):
>>>>         lines = []
>>>>         while "f is not empty":
>>>>             line = f.readline()
>>>>             if not line: break
>>>>             if len(line) > 2 and line[-2:] == '|\n':
>>>>                 lines.append(line)
>>>>                 yield ''.join(lines)
>>>>                 lines = []
>>>>             else:
>>>>                 lines.append(line)
>>> 
>>> There's a few changes I'd make:
>>> I'd change the name to something else, so as not to shadow the built-in,
> ...
> Actually, as an experienced programmer, I *do* think it is confusing as
> evidenced by the mistake Dave made!  Segregated namespaces are wonderful
> (per Zen), but let's not pollute multiple namespaces with same name,
> either.
>
> It may not be literally shadowing the built-in, but it definitely
> mentally shadows the built-in.

I disagree with you. namespaces are there that in working
with a namespace I do not need to worry much about other
namespaces. Therefore, calling a function "readlines"
is very much justified (if it reads lines from a file), even
though there was a module around with name "readlines".
By the way, the module is named "readline" (not "readlines").

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


Thread

RE: Python garbage collector/memory manager behaving strangely "Jadhav, Alok" <alok.jadhav@credit-suisse.com> - 2012-09-17 10:28 +0800
  Re: Python garbage collector/memory manager behaving strangely alex23 <wuwei23@gmail.com> - 2012-09-16 20:25 -0700
    Re: Python garbage collector/memory manager behaving strangely 88888 Dihedral <dihedral88888@googlemail.com> - 2012-09-16 21:39 -0700
    Re: Python garbage collector/memory manager behaving strangely Dave Angel <d@davea.name> - 2012-09-17 06:46 -0400
      Re: Python garbage collector/memory manager behaving strangely Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-17 11:47 +0000
        Re: Python garbage collector/memory manager behaving strangely Dave Angel <d@davea.name> - 2012-09-17 08:03 -0400
        Re: Python garbage collector/memory manager behaving strangely aahz@pythoncraft.com (Aahz) - 2012-11-14 06:19 -0800
          Re: Python garbage collector/memory manager behaving strangely Dieter Maurer <dieter@handshake.de> - 2012-11-15 08:31 +0100
    RE: Python garbage collector/memory manager behaving strangely "Jadhav, Alok" <alok.jadhav@credit-suisse.com> - 2012-09-17 19:00 +0800
  Re: Python garbage collector/memory manager behaving strangely Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-11-15 12:20 +0100

csiph-web