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


Groups > comp.lang.python > #110905

Re: Creating a calculator

From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: Creating a calculator
Date 2016-07-01 07:15 -0700
Message-ID <mailman.1.1467386156.2295.python-list@python.org> (permalink)
References (2 earlier) <lf5oa6hhn9x.fsf@ling.helsinki.fi> <0E77E5BC-E8CC-4951-B520-37BF2E596D3A@icloud.com> <mailman.156.1467375975.2358.python-list@python.org> <577675ae$0$1604$c3e8da3$5496439d@news.astraweb.com> <E77960C7-B61C-4C97-8F5A-D94250C769F5@icloud.com>

Show all headers | View raw


> On Jul 1, 2016, at 6:52 AM, Steven D'Aprano <steve@pearwood.info> wrote:
> 
>> On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
>> 
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
> [...]
>> By using * to unpack the split line, my program no longer crashes and no
>> try/except block is needed to work around the crash. A later line of code
>> will test the expression, ignore if empty or run regex if full.
> 
> I wish you wouldn't describe this as "crash".
> 
> The Python interpreter should never crash. That would be a segmentation
> fault, and that is considered to be a very serious bug.
> 
> But *raising an exception* is another story. Raising exceptions is not a
> crash, it is the interpreter working as expected. This statement:
> 
>    line_number, keyword, expr = "20 END".split(' ', 2)
> 
> is SUPPOSED to raise an exception, if it didn't, the interpreter would be
> broken. To call that a "crash" is horribly misleading.

Where did I write that the Python interpreter had "crashed"?

I wrote that *my program* crashed and I found an elegant solution to prevent the crashing from happening in the first place that doesn't require a try/except block.

Chris R.

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


Thread

Creating a calculator Elizabeth Weiss <cake240@gmail.com> - 2016-06-30 20:08 -0700
  Re: Creating a calculator Michael Torrie <torriem@gmail.com> - 2016-06-30 21:38 -0600
  Re: Creating a calculator DFS <nospam@dfs.com> - 2016-06-30 23:57 -0400
  Re: Creating a calculator DFS <nospam@dfs.com> - 2016-07-01 00:54 -0400
    Re: Creating a calculator Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-07-01 09:42 +0300
      Re: Creating a calculator Christopher Reimer <christopher_reimer@icloud.com> - 2016-07-01 05:25 -0700
        Re: Creating a calculator Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-07-01 15:46 +0300
          Re: Creating a calculator Christopher Reimer <christopher_reimer@icloud.com> - 2016-07-01 06:19 -0700
            Re: Creating a calculator Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-07-01 16:35 +0300
        Re: Creating a calculator Steven D'Aprano <steve@pearwood.info> - 2016-07-01 23:52 +1000
          Re: Creating a calculator alister <alister.ware@ntlworld.com> - 2016-07-01 14:21 +0000
          Re: Creating a calculator Christopher Reimer <christopher_reimer@icloud.com> - 2016-07-01 07:15 -0700
          Re: Creating a calculator Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-07-01 20:44 +0300
          Re: Creating a calculator Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-07-04 12:32 +0200
      Re: Creating a calculator DFS <nospam@dfs.com> - 2016-07-01 20:16 -0400
    Re: Creating a calculator pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-07-01 11:34 +0200
      Re: Creating a calculator Chris Warrick <kwpolska@gmail.com> - 2016-07-01 13:39 +0200
        Re: Creating a calculator pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-07-01 15:03 +0200
      Re: Creating a calculator DFS <nospam@dfs.com> - 2016-07-01 20:16 -0400
        Re: Creating a calculator pdorange@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) - 2016-07-04 11:50 +0200
        Re: Creating a calculator BartC <bc@freeuk.com> - 2016-07-06 01:53 +0100
          Re: Creating a calculator Quivis <quivis@domain.invalid> - 2016-07-07 22:00 +0000
  Re: Creating a calculator Chris Warrick <kwpolska@gmail.com> - 2016-07-01 10:57 +0200

csiph-web