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


Groups > comp.lang.python > #110905

Re: Creating a calculator

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: Creating a calculator
Date Fri, 01 Jul 2016 07:15:19 -0700
Lines 32
Message-ID <mailman.1.1467386156.2295.python-list@python.org> (permalink)
References <a0ed0591-dcbb-4ad2-b69a-58feef50153a@googlegroups.com> <nl4t1n$qgp$2@dont-email.me> <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>
Mime-Version 1.0 (1.0)
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de TAqmdGq/CSWgP7Moz5Q4/Q+McRkZ9+OITtG/7U9AURGw==
Return-Path <christopher_reimer@icloud.com>
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; 'broken': 0.03; 'bug.': 0.07; 'elegant': 0.07; 'cc:addr:python-list': 0.09; 'block.': 0.09; 'broken.': 0.09; 'exception,': 0.09; 'expected.': 0.09; 'interpreter,': 0.09; 'unpack': 0.09; 'python': 0.10; 'ignore': 0.14; 'interpreter': 0.15; '2016': 0.16; '6:52': 0.16; 'crashed': 0.16; 'crashes': 0.16; "didn't,": 0.16; 'expr': 0.16; 'keyword,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'try/except': 0.16; 'wrote:': 0.16; 'later': 0.16; "wouldn't": 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'prevent': 0.20; 'exceptions': 0.22; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'wrote': 0.23; 'split': 0.23; "doesn't": 0.26; 'chris': 0.26; 'fri,': 0.27; 'received:17': 0.27; 'raise': 0.29; 'code': 0.30; 'supposed': 0.31; 'another': 0.32; 'run': 0.33; "d'aprano": 0.33; 'raising': 0.33; 'steven': 0.33; 'but': 0.36; 'should': 0.36; 'needed': 0.36; 'basic': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'test': 0.39; 'where': 0.40; 'header:MIME-version:1': 0.60; 'wish': 0.71; 'jul': 0.72; 'header :In-reply-to:1': 0.84; 'story.': 0.96; 'serious': 0.97
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2016-07-01_04:,, signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1607010143
X-Mailer iPhone Mail (13F69)
In-reply-to <577675ae$0$1604$c3e8da3$5496439d@news.astraweb.com>
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1467382521; bh=33wa1uC3h1GkTNmuqeyXQiKz2iUiZuGfT8kxhG/im8Q=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=mrsDKrs8Yqqkcy5dE8RoGCaewa77JT6lnanuDUqVboGIzfPCeI4ssaNMCrS7DCqPN 0nijelnicapcTVP4yr0I9ksF+fUJzAWSYbhbauFzIQ5NWuCHSSjGPSeJFJF7BilJHR crArFhV2jYWo0PQ+81pipiQ0Td5ON4F/2coQfoX5NvXGMpnWjDi8hXGmm4+8FR6bLe 3IukCwdao3bMhTjNaYYmg3C6jQU8F2TGwAUBsRbVhEi3QE42vxoNqLu2xOpvSPIGeo twSEEf/GEhCbdXGzrm1CseMDFRhm1iQAgHL0NkhpAdf4wHZ17SFaVVhVcy60jF0D/C MknSSkMl5YRpQ==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <E77960C7-B61C-4C97-8F5A-D94250C769F5@icloud.com>
X-Mailman-Original-References <a0ed0591-dcbb-4ad2-b69a-58feef50153a@googlegroups.com> <nl4t1n$qgp$2@dont-email.me> <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>
Xref csiph.com comp.lang.python:110905

Show key headers only | 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