Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82314
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'binary': 0.07; 'subject:two': 0.07; 'ugly': 0.07; 'alternatives': 0.09; 'subject:()': 0.09; 'cc:addr:python-list': 0.11; 'suggest': 0.14; 'arithmetic.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'needless': 0.16; 'wrote:': 0.18; 'implementing': 0.19; 'thu,': 0.19; 'work,': 0.20; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'subject:numbers': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'little': 0.38; "you're": 0.61; 'guaranteed': 0.75; 'racing': 0.84; 'to:none': 0.92 |
| 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:cc :content-type; bh=/XYXGiHEQ3PMdGt2JMY+7ndEQCyZuja1A9Cy/xz0uyM=; b=gUBUcbgDLtyn4jv3tRyKTTpZAGh0r1MpQHV6dpRsPPglSSjbhItwqbjqRUt4GXU4Me SB5CSbL1+2I4BLOYHXOFhl7IX5U8xJfZYzyFYoi/Qwq5ivEPujR+Jr9KO+KlhgAay/GC eBG+zx66IH2GRA+Tpuek3rr/ylekMLrpUUhRKUeLhfic21HL1XUmJGNSJ50TC2GEqGaZ X4LT9MQwWPTjfGw6q4dTzAG36xCmAmifDAL9p5PPfifzt0lnFmPyMd3wt6Xsvj9CMs69 B3lE9mUVWOcoJpd4QmcpwR9WNdavAE7VJiLfhbc4+e/EDKfJ7Zf09O6hrGljWVkGWNNr 0MSg== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.79.135 with SMTP id j7mr10665723igx.14.1418250732749; Wed, 10 Dec 2014 14:32:12 -0800 (PST) |
| In-Reply-To | <CALxg4FXb=_--6aCgMq0fNqY=vYZhS_0B2odEWyWJ_ZM6s=HgyA@mail.gmail.com> |
| References | <CALxg4FXb=_--6aCgMq0fNqY=vYZhS_0B2odEWyWJ_ZM6s=HgyA@mail.gmail.com> |
| Date | Thu, 11 Dec 2014 09:32:12 +1100 |
| Subject | Re: Coercing two numbers without coerce() |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.16830.1418251156.18130.python-list@python.org> (permalink) |
| Lines | 12 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1418251156 news.xs4all.nl 2970 [2001:888:2000:d::a6]:49465 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:82314 |
Show key headers only | View raw
On Thu, Dec 11, 2014 at 9:27 AM, Luciano Ramalho <luciano@ramalho.org> wrote: > I know I can do type(A+B)(A), or A+B-B, but both alternatives are ugly > and perform needless arithmetic. > > What do you suggest, now that the coerce() built-in is not available? I would suggest just doing the arithmetic :) That's guaranteed to work, and a little addition isn't that costly. (As long as you're not Numberphile and implementing four-bit binary arithmetic in racing dominoes. Then it's costly.) ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Coercing two numbers without coerce() Chris Angelico <rosuav@gmail.com> - 2014-12-11 09:32 +1100
csiph-web