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


Groups > comp.lang.python > #30730

Re: final question: logging to stdout and updating files

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'heavily': 0.04; 'things.': 0.05; 'important,': 0.07; 'subject:question': 0.08; 'python': 0.09; '===': 0.09; 'advice.': 0.09; 'code"': 0.09; 'subject:files': 0.09; 'sure,': 0.09; 'yeah,': 0.09; 'bug': 0.10; '*any*': 0.16; 'bugs,': 0.16; 'ensured': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "guido's": 0.16; 'indent': 0.16; 'oct': 0.16; 'silly': 0.16; 'wrote:': 0.17; 'meant': 0.21; 'minor': 0.22; 'this:': 0.23; 'machine': 0.24; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'bugs': 0.27; 'message- id:@mail.gmail.com': 0.27; "d'aprano": 0.29; 'indentation': 0.29; 'optional': 0.29; 'steven': 0.29; 'worked': 0.30; 'fri,': 0.30; 'code': 0.31; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'fastest': 0.35; 'moved': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'next': 0.35; 'really': 0.36; 'created': 0.36; 'except': 0.36; 'but': 0.36; 'test': 0.36; 'correctly': 0.37; 'optimization': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'comment': 0.38; 'to:addr:python.org': 0.39; 'space': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'end': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'most': 0.61; 'australia': 0.62; 'life,': 0.62; 'peace': 0.62; 'world': 0.63; 'existence.': 0.84; 'optimized,': 0.84; 'peace,': 0.84; 'won': 0.96
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:to :content-type; bh=2svlKCavuuk0jX224OTfbXJ97S2f1kSYLWWFVn8LBNA=; b=EQs4omvBloevpkdszW9KwU4m15qFcFq9TTNcKxUSYOqguEfyuRppnP0Hn/3ycvo6HV I2N3CH5iVNpOZJfP4QoONCw2O0ElCB6Sl8Z69ZdpjZREX0ovRCJRM/lfZrj1htEv93xS pNTe8GK1on/sP8AekrPO7FpEWalG3C9vpk5zKKK6D0WXknz7Y0z7Xf0JWlIUVS7aaOjU 1nkEQpsnKVwB4RsC3Kow0eCgtywb1H2ssWUM4cSlBW2OHrjNKRMkr1ML5TVvETjuYj57 Wi1TrOJjQvVdYKuw2m58ZLkve/vI0F+LE7UR8eNHAX3EEMIts+YmZ60Zoy/rAsRuWLlE DzCw==
MIME-Version 1.0
In-Reply-To <506d967a$0$29978$c3e8da3$5496439d@news.astraweb.com>
References <mailman.1781.1349320295.27098.python-list@python.org> <mailman.1797.1349357671.27098.python-list@python.org> <506d967a$0$29978$c3e8da3$5496439d@news.astraweb.com>
Date Fri, 5 Oct 2012 00:27:34 +1000
Subject Re: final question: logging to stdout and updating files
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.1800.1349360858.27098.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349360858 news.xs4all.nl 6919 [2001:888:2000:d::a6]:54964
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30730

Show key headers only | View raw


On Fri, Oct 5, 2012 at 12:00 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> That is *terrible* advice. But if you insist on following it, you can
> optimize *any* Python program to this:
>
> # === start code ===
> pass  # this line is optional
> # === end code ===
>
>
> There you go. The most heavily optimized, fastest Python program in
> existence. Sure, it has a few bugs, but boy is it fast!!!

Not many bugs though! I ran it in my Python 5.2.7 for GNU/Windows
256-bit (err, yeah, I borrowed Guido's time machine but had the silly
thing in reverse... oops) and it worked perfectly, except that
indentation has moved from "significant" to "mandatory". When I added
the necessary 5 space indent at the beginning, it correctly created
world peace, ensured that Australia won the next Test Match, and then
printed "Hello, world!\n" to stdout. Unfortunately, a bug in your "end
code" comment meant that the peace it created was by wiping out all
life, but that's pretty minor in the scheme of things.

Optimization really is that important, folks!

ChrisA
may need to schedule surgical detongueing of his cheek

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


Thread

final question: logging to stdout and updating files "Littlefield, Tyler" <tyler@tysdomain.com> - 2012-10-03 21:11 -0600
  Re: final question: logging to stdout and updating files Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 00:53 -0700
  Re: final question: logging to stdout and updating files Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 00:53 -0700
  Re: final question: logging to stdout and updating files Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 06:34 -0700
  Re: final question: logging to stdout and updating files Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 06:34 -0700
    Re: final question: logging to stdout and updating files Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-04 14:00 +0000
      Re: final question: logging to stdout and updating files Chris Angelico <rosuav@gmail.com> - 2012-10-05 00:27 +1000
      RE: final question: logging to stdout and updating files "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-04 22:36 +0000
      Re: final question: logging to stdout and updating files Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-05 09:11 +0100
      Re: final question: logging to stdout and updating files Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-05 09:19 +0100
      Re: final question: logging to stdout and updating files Ramchandra Apte <maniandram01@gmail.com> - 2012-10-05 06:32 -0700
  Re: final question: logging to stdout and updating files Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-04 14:52 +0000

csiph-web