Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9613
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!feeder.news-service.com!news2.euro.net!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.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'suppose': 0.05; 'received:209.85.214.174': 0.13; 'received:mail- iw0-f174.google.com': 0.13; 'wrote:': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lambda': 0.16; 'operators,': 0.16; '16,': 0.16; 'pm,': 0.16; 'math': 0.21; 'header:In-Reply-To:1': 0.22; 'missed': 0.24; 'received:209.85.214': 0.28; 'sat,': 0.28; 'message- id:@mail.gmail.com': 0.28; 'import': 0.29; 'object': 0.30; 'version': 0.30; 'subject:?': 0.31; 'usual': 0.32; 'to:addr :python-list': 0.34; 'there': 0.34; 'addition,': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'steven': 0.38; 'think': 0.38; 'else': 0.38; "there's": 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'something.': 0.91; 'subject:there': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ie0Sq9JKoqHGw7w/W2tjwEE2p7b9z9+G+JOVbnVMsdo=; b=QEge0dpqrsXpXyBA52ntMcMjh2h00PUmh4cZgYuFKmGQOzVOEJG0PugORc9KINtNMb UZxhlDfho5658UJq4QXgBDvhYq+VrAl4mOC/LxxFaMk6KYCSMGDfHRFMSnxLZ8rqNCzs 2pYg1I/mVQAcyUMToqSzHOm6+zRQ1f9cgb0U0= |
| MIME-Version | 1.0 |
| In-Reply-To | <4e214d5a$0$29975$c3e8da3$5496439d@news.astraweb.com> |
| References | <4e214d5a$0$29975$c3e8da3$5496439d@news.astraweb.com> |
| Date | Sat, 16 Jul 2011 19:14:47 +1000 |
| Subject | Re: Is there a way to customise math.sqrt(x) for some x? |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.1106.1310807690.1164.python-list@python.org> (permalink) |
| Lines | 16 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1310807690 news.xs4all.nl 23918 [2001:888:2000:d::a6]:59773 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:9613 |
Show key headers only | View raw
On Sat, Jul 16, 2011 at 6:35 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > I have a custom object that customises the usual maths functions and > operators, such as addition, multiplication, math.ceil etc. > > Is there a way to also customise math.sqrt? I don't think there is, but I > may have missed something. Only thing I can think of is: import math math.sqrt=lambda(x) x.__sqrt__(x) if x.whatever else math.sqrt(x) I don't suppose there's a lambda version of try/catch? ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there a way to customise math.sqrt(x) for some x? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-16 18:35 +1000
Re: Is there a way to customise math.sqrt(x) for some x? Chris Angelico <rosuav@gmail.com> - 2011-07-16 19:14 +1000
Re: Is there a way to customise math.sqrt(x) for some x? Nobody <nobody@nowhere.com> - 2011-07-16 14:42 +0100
Re: Is there a way to customise math.sqrt(x) for some x? John Nagle <nagle@animats.com> - 2011-07-23 08:31 -0700
Re: Is there a way to customise math.sqrt(x) for some x? Peter Otten <__peter__@web.de> - 2011-07-16 11:37 +0200
Re: Is there a way to customise math.sqrt(x) for some x? Gary Herron <gherron@islandtraining.com> - 2011-07-16 08:56 -0700
Re: Is there a way to customise math.sqrt(x) for some x? rantingrick <rantingrick@gmail.com> - 2011-07-23 14:09 -0700
csiph-web