Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Python path and append Date: Tue, 26 Apr 2016 10:25:46 +1000 Lines: 11 Message-ID: References: <27nshbp40p1llr231dqm31p754tvurkb8i@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de TE4jhJ2ppJ3UYePE54u95gaVdQWXR4AG/QwPpeQXVdGw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'memory.': 0.05; 'rename': 0.07; 'cc:addr:python-list': 0.09; 'overwrite': 0.09; 'file,': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rewriting': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'work,': 0.21; 'file.': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'tue,': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'instead': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'doing': 0.38; "won't": 0.38; 'received:209': 0.38; 'anything': 0.38; 'your': 0.60; 'john': 0.61; "you'll": 0.61; 'more': 0.63; 'importantly,': 0.66; '26,': 0.72; 'around,': 0.84; 'chrisa': 0.84; 'to:none': 0.91; 'sitting': 0.93 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:cc; bh=PjYX0I09uXeYI91VcVkAlO0KclryuCUTPF7VLKVTl68=; b=txpyfB8pc8hLNZ8rcZJyN4EEZE132959AjWX2Q6G0TwnFroNswH5NB+oEb4AaoGwJa b91UAYKXOfErkvJHu50o+C9hmJpdBpVFppsNGbyZPdZ3yQWtSTavqtSLv2SEFIiMWDIg PwGbRhsWlm1ZRE8CurvtPKGpFDNWFNd3x4q4UxYFmO6qdGI3zRaWrZZTY6qp+Od6z+Hd Xln6ZMXDT0t0x4Jn5PaX9hIMns6MTM046qBpSzCdjf00jwmmEYH/OjGj34dMjZC0mlPP ESzkT/svXrxNokbiXS+kMPSqnjeD62tscjPYWhr6PBhaH120tkUxj9ml+gVWTypQG5lv wUnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=PjYX0I09uXeYI91VcVkAlO0KclryuCUTPF7VLKVTl68=; b=NryvNvkGe+PlhvWzCfymXj1l37XZ24EkB7GIjwESlljcFq6cBnR7Kcx7g+DQeEhFFj crQHOz1HQix13FDjPI0Fs6tvYMKAJHPpCX+q9V9DWiqo+rKrW3ZmvpbMWhUb/oNYUgPB 68V19e7JKZHqqPDJTZWN/XQHR+RQkUWeqDlMgBAGocMUFSZ0qFKXT8HKRBhzZ2dq1goQ YmJvNG01VGc+Fa0pNQP1APEelOX2IEtI73zMrSoCRPNqV3Cm3Y7FRXNQ8tj7Hbac85KO y9wb6LjnhvpHgeJXfCWGRCvWXJl5fumKtJgXcIlCHhnYH9PDW5Y2P+r1sjVSLioPL7uL MmHg== X-Gm-Message-State: AOPr4FVyCyT4lOq0+qQIAExSYvFbd+x4IeQl1S8NCt3gtJqL7jYTeqe3DTik8FPbX1M97J5INSBiMotyZqMX5g== X-Received: by 10.107.169.13 with SMTP id s13mr139057ioe.19.1461630346155; Mon, 25 Apr 2016 17:25:46 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <27nshbp40p1llr231dqm31p754tvurkb8i@4ax.com> Xref: csiph.com comp.lang.python:107635 On Tue, Apr 26, 2016 at 7:26 AM, John Gordon wrote: > It's much easier to create a new file and then rename it afterwards, > instead of rewriting the original file. And more importantly, it's safer. If anything happens to your process while it's doing its work, you'll have a junk file sitting around, but you won't have lost everything. If you overwrite the existing file, you (often) depend on completely writing out the content you have in memory. ChrisA