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


Groups > comp.lang.python > #80781

Re: I love assert

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
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; 'example:': 0.03; 'cpython': 0.05; 'correct.': 0.07; 'debug': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'handful': 0.09; 'message- id:@stoneleaf.us': 0.09; 'pgp': 0.09; 'python:': 0.09; 'skip:g 60': 0.09; 'skip:t 60': 0.09; '~ethan~': 0.09; 'python': 0.11; 'language.': 0.14; '(gnu/linux)': 0.16; '-----begin': 0.16; '----- end': 0.16; './python': 0.16; 'agree.': 0.16; 'code?': 0.16; 'configuring,': 0.16; 'gnupg': 0.16; 'hash:': 0.16; 'sha1': 0.16; 'skip:/ 60': 0.16; 'skip:d 60': 0.16; 'skip:j 60': 0.16; 'skip:q 60': 0.16; 'skip:v 60': 0.16; 'language': 0.16; 'wrote:': 0.18; 'message-----': 0.19; 'normally': 0.19; 'skip:a 60': 0.19; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'specify': 0.24; 'signed': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'on,': 0.29; 'am,': 0.29; 'mode': 0.30; 'primarily': 0.30; '(which': 0.31; 'disabled': 0.31; 'skip:i 60': 0.31; 'languages': 0.32; 'option': 0.32; 'run': 0.32; 'worked': 0.33; 'running': 0.33; 'but': 0.35; 'add': 0.35; 'really': 0.36; 'false': 0.36; 'in.': 0.36; 'version:': 0.36; 'charset:us-ascii': 0.36; 'turn': 0.37; 'easily': 0.37; 'performance': 0.37; 'checks': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'does': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'improved': 0.60; 'new': 0.61; 'received:173': 0.61; 'making': 0.63; 'great': 0.65; 'production': 0.68; 'optimized': 0.68; 'unusual': 0.74; 'ethan': 0.84; 'furman': 0.84; 'lean': 0.84; 'remembering': 0.84
Date Fri, 14 Nov 2014 12:41:09 -0800
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
To python-list@python.org
Subject Re: I love assert
References <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> <cf68f3b4-3312-4dda-a224-8f30f7b31b55@googlegroups.com> <87a93wqeq3.fsf@elektro.pacujo.net> <mailman.15744.1415829173.18130.python-list@python.org> <5465e887$0$12976$c3e8da3$5496439d@news.astraweb.com> <mailman.15827.1415989114.18130.python-list@python.org> <87ppcpmw9i.fsf@elektro.pacujo.net>
In-Reply-To <87ppcpmw9i.fsf@elektro.pacujo.net>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15829.1415997675.18130.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415997675 news.xs4all.nl 2905 [2001:888:2000:d::a6]:53374
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80781

Show key headers only | View raw


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/14/2014 11:12 AM, Marko Rauhamaa wrote:
> Ethan Furman wrote:
> 
>> My point being: a safety net that is so easily disabled does not count (IMHO) as a backup.
> 
> Correct. You never lean on assertions. They are primarily formal comments.

On this point we can agree.  :)


>> This is one my very few complaints about Python: running it normally is the same as running with DEBUG turned
>> on, so the unusual case is remembering to run with asserts turned /off/.
> 
> I don't remember ever having optimized them out in any programming language. Has that really improved the 
> performance of your code?

In the handful of languages I have worked with so far, it's the other way 'round:  you un-optimize debug mode in.
CPython itself is a good example: when configuring, you must add --with-pydebug in order to get all the extra checks
added (which is great when adding new features), but that option isn't used when making production CPythons; yet
Python the language is just the opposite: debug mode is on /by default/, and to turn it off you have to specify -O:

$ ./python -c "print(__debug__)"
True

$ ./python -O -c "print(__debug__)"
False

- --
~Ethan~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJUZmjlAAoJENZ7D1rrH75N3wMP/j9AowuuEvW9khTFX512QUHn
VGwEqkIu4FDFRA8T+qzwqhL7st5GGsnXaPvaWCLmPGbtt1qrVxJ1M6LLkuSWI8Fj
/hGe5rcEPP88/tMA5zy/pmg6jDgl96hojCnDmmS6meIQijVRpxMUGQ/4+N1oKI5d
JYKOlhFStk0N5O6gyZ3Yc6UDY+I9kLVPZsIgH0bXx5IkvwQUi1aNboADehDgSbM5
XDCuZvfNsauKyJZL52NkKu6qLSY/CHDx4kaWdP/i75gZPeVJirjEUkcLYSK6iE19
DpkyeR5wetH1yppH27yyfZPCKHnaYD8O/rykRrQLaIYefKb7XhxGWXa4C17w+AQP
3+hjONiPBsXe2FZZNTskKufI88oXbFwTyI3GseeWTIbS+V9TIwGTjZA+V9jc6EvL
T6T9PRGwOzfPolcLZ43x3ea8uCzLhxe0BILEfdmv6XPoPl9sJ5wHhbxg0oblo8GL
GNkfOFw0ncxplyobU0RXhvsKCUg6EpAukWgIcX5IhHfnesoS1BpSMtZubAbY4GVI
AHzL34KpYhOIDo3Ws26dCtHz5ocJSnDlHv2lxv+iEEZV+4lShFEreqfCLK0hcJTP
QMFoI401Dy3bLd3wJX9mYQA+nMGhNtRK+4uYwGSbAinOGDKVuqrmNM7wCaF9lr/I
aC+wno9PzNxkDNy2nUpY
=gJhZ
-----END PGP SIGNATURE-----

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


Thread

I love assert Peter Cacioppi <peter.cacioppi@gmail.com> - 2014-11-11 11:40 -0800
  Re: I love assert Ben Finney <ben+python@benfinney.id.au> - 2014-11-12 07:03 +1100
    Re: I love assert Grant Edwards <invalid@invalid.invalid> - 2014-11-11 21:43 +0000
  Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-11 12:08 -0800
  Re: I love assert Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-11-11 12:20 -0800
  Re: I love assert Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-11 20:34 +0000
  Re: I love assert TP <wingusr@gmail.com> - 2014-11-11 12:57 -0800
  Re: I love assert Terry Reedy <tjreedy@udel.edu> - 2014-11-11 17:34 -0500
  Re: I love assert Ben Finney <ben+python@benfinney.id.au> - 2014-11-12 09:52 +1100
  Re: I love assert Tim Chase <python.list@tim.thechases.com> - 2014-11-11 17:03 -0600
  Re: I love assert Peter Cacioppi <peter.cacioppi@gmail.com> - 2014-11-11 15:02 -0800
  Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-11 15:38 -0800
  Re: I love assert Dan Stromberg <drsalists@gmail.com> - 2014-11-11 17:56 -0800
  Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-12 13:21 +1100
  Re: I love assert Ben Finney <ben+python@benfinney.id.au> - 2014-11-12 13:35 +1100
    Re: I love assert Grant Edwards <invalid@invalid.invalid> - 2014-11-12 14:10 +0000
  Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-12 13:44 +1100
    Re: I love assert wxjmfauth@gmail.com - 2014-11-11 23:14 -0800
  Re: I love assert Terry Reedy <tjreedy@udel.edu> - 2014-11-12 03:29 -0500
  Re: I love assert Anton <anton.schattenfeld@gmail.com> - 2014-11-12 12:53 -0800
    Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-12 23:41 +0200
      Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-12 13:52 -0800
        Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-12 23:56 +0200
          Re: I love assert Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 15:04 -0700
            Re: I love assert Anton <anschatten@gmail.com> - 2014-11-12 14:13 -0800
              Re: I love assert Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 15:41 -0700
                Re: I love assert Anton <anschatten@gmail.com> - 2014-11-12 14:48 -0800
                Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-13 01:01 +0200
                Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-15 10:40 +1100
                Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 02:12 +0200
                Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-15 12:04 +1100
                Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 03:30 +0200
                Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-15 12:48 +1100
                Re: I love assert Tim Chase <python.list@tim.thechases.com> - 2014-11-14 20:14 -0600
                Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-15 13:16 +1100
                Re: I love assert albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-11-29 17:35 +0000
                Re: I love assert Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 16:02 -0700
                Re: I love assert Anton <anschatten@gmail.com> - 2014-11-12 15:43 -0800
                Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-13 10:10 +1100
                Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-13 01:23 +0200
                Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-13 10:27 +1100
                Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-13 01:31 +0200
              Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-12 14:47 -0800
                Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-14 22:37 +1100
                Re: I love assert Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-14 09:40 -0700
          Re: I love assert Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 15:07 -0700
            Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-13 00:47 +0200
              Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-12 14:56 -0800
              Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-13 09:58 +1100
              Re: I love assert Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-12 16:05 -0700
                Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-13 01:12 +0200
              Re: I love assert Lie Ryan <lie.1296@gmail.com> - 2014-11-14 01:09 +1100
        Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-14 22:33 +1100
          Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-14 10:18 -0800
            Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-14 21:12 +0200
              Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-14 12:41 -0800
                Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-14 22:50 +0200
            Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-15 13:58 +1100
              Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-14 20:09 -0800
                Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-17 13:09 +1100
                Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-16 19:25 -0800
      Re: I love assert Anton <anschatten@gmail.com> - 2014-11-12 14:00 -0800
        Re: I love assert Anton <anschatten@gmail.com> - 2014-11-12 14:04 -0800
          Re: I love assert Marko Rauhamaa <marko@pacujo.net> - 2014-11-13 00:34 +0200
    Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-13 09:43 +1100
  Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-14 22:15 +1100
  Re: I love assert Richard Riehle <rriehle@itu.edu> - 2014-11-14 14:09 -0800
    Decorators (was: Re: I love assert) Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 00:18 +0200
      Re: Decorators Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-14 22:37 +0000
        Re: Decorators Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 00:47 +0200
      Re: Decorators (was: Re: I love assert) Richard Riehle <rriehle@itu.edu> - 2014-11-14 18:19 -0800
        Re: Decorators (was: Re: I love assert) Mayank Tripathi <oquanox@gmail.com> - 2014-11-15 02:36 +0000
        Re: Decorators (was: Re: I love assert) Tim Chase <python.list@tim.thechases.com> - 2014-11-14 20:30 -0600
          Re: Decorators Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 09:00 +0200
            Re: Decorators Grant Edwards <invalid@invalid.invalid> - 2014-11-15 15:32 +0000
        Re: Decorators (was: Re: I love assert) Richard Riehle <rriehle@itu.edu> - 2014-11-14 23:42 -0800
        Re: Decorators Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-15 13:12 +0000
          Re: Decorators Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 15:24 +0200
            Re: Decorators Terry Reedy <tjreedy@udel.edu> - 2014-11-15 15:28 -0500
        Re: Decorators (was: Re: I love assert) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-16 02:39 +1100
  Re: I love assert TP <wingusr@gmail.com> - 2014-11-27 01:22 -0800
    Re: I love assert alister <alister.nospam.ware@ntlworld.com> - 2014-11-27 09:59 +0000
      Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-29 12:30 +1100
        Re: I love assert MRAB <python@mrabarnett.plus.com> - 2014-11-29 02:56 +0000
          Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-29 20:31 +1100
            Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-29 21:40 +1100
            Re: I love assert MRAB <python@mrabarnett.plus.com> - 2014-11-29 19:49 +0000
        Re: I love assert Chris Angelico <rosuav@gmail.com> - 2014-11-29 14:02 +1100
        Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-29 14:33 -0800
          Re: I love assert Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-30 19:18 +1100
            Re: I love assert Ethan Furman <ethan@stoneleaf.us> - 2014-11-30 11:34 -0800

csiph-web