Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20279
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| 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; 'interpreter': 0.05; 'subject:Python': 0.05; 'python': 0.08; 'assert': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'alternative,': 0.16; 'bieber': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'in-line': 0.16; 'message-id:@4ax.com': 0.16; 'otoh,': 0.16; 'received:wlfraed': 0.16; 'syntaxerror:': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'syntax': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'received:166': 0.18; '(most': 0.21; 'url:home': 0.21; "doesn't": 0.22; 'feb': 0.22; 'math': 0.24; 'traceback': 0.24; 'code': 0.26; 'invalid': 0.28; 'problem': 0.29; 'operation.': 0.30; 'sun,': 0.30; 'syntax,': 0.30; 'file': 0.34; 'header:X-Complaints-To:1': 0.34; 'lee': 0.34; 'assignment': 0.34; 'last):': 0.34; 'to:addr:python-list': 0.35; 'however,': 0.35; 'received:org': 0.36; 'but': 0.37; 'charset:us-ascii': 0.37; 'using': 0.37; 'except': 0.39; 'might': 0.40; 'to:addr:python.org': 0.40; 'dennis': 0.73; '-0500,': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: Numeric root-finding in Python |
| Date | Sun, 12 Feb 2012 11:47:31 -0500 |
| References | <4f375f0f$0$29986$c3e8da3$5496439d@news.astraweb.com> <2276591.XVerqeASP3@mach-114-20> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | mobile-166-147-102-138.mycingular.net |
| X-Newsreader | Forte Agent 6.00/32.1186 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.5731.1329065705.27778.python-list@python.org> (permalink) |
| Lines | 52 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1329065705 news.xs4all.nl 6969 [2001:888:2000:d::a6]:48414 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:20279 |
Show key headers only | View raw
On Sun, 12 Feb 2012 10:20:17 -0500, inq1ltd <inq1ltd@inqvista.com>
wrote:
>
>
>I don't know the first thing about this math problem however,
>
>if I were to code this I might try ;
>
> except ZeroDivisionError:
> assert w = -1
Uhm, that's invalid syntax, to my knowledge... Python doesn't allow
assignment (=) as an in-line operation.
>
>rather than;
>
> except ZeroDivisionError:
> assert w == -1
>
This, OTOH, is a comparison operation...
For small integers, using
assert w is -1
might be an alternative, but it IS relying on the interpreter
implementation.
>>> w = 0
>>> assert w = -1
Traceback ( File "<interactive input>", line 1
assert w = -1
^
SyntaxError: invalid syntax
>>> assert w == -1
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
AssertionError
>>> assert w is -1
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
AssertionError
>>> w = -1
>>> assert w == -1
>>> assert w is -1
>>>
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Numeric root-finding in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-12 06:41 +0000
Re: Numeric root-finding in Python Eelco <hoogendoorn.eelco@gmail.com> - 2012-02-12 02:10 -0800
Re: Numeric root-finding in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-12 13:39 +0000
Re: Numeric root-finding in Python Terry Reedy <tjreedy@udel.edu> - 2012-02-12 16:19 -0500
Re: Numeric root-finding in Python 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-12 05:13 -0800
Re: Numeric root-finding in Python Robert Kern <robert.kern@gmail.com> - 2012-02-12 13:52 +0000
Re: Numeric root-finding in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-12 22:53 +0000
Re: Numeric root-finding in Python inq1ltd <inq1ltd@inqvista.com> - 2012-02-12 10:20 -0500
Re: Numeric root-finding in Python David Monaghan <monaghand.david@gmail.com> - 2012-02-21 01:33 +0000
Re: Numeric root-finding in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-21 02:21 +0000
Re: Numeric root-finding in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-02-12 11:47 -0500
Re: Numeric root-finding in Python Dave Angel <d@davea.name> - 2012-02-12 12:00 -0500
Re: Numeric root-finding in Python Mark Dickinson <mdickinson@enthought.com> - 2012-02-12 12:18 -0800
Re: Numeric root-finding in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-12 23:05 +0000
Re: Numeric root-finding in Python Dave Angel <d@davea.name> - 2012-02-12 18:52 -0500
csiph-web