Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9626
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <gherron@islandtraining.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.135 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.74; '*S*': 0.01; 'received:66.35': 0.09; 'am,': 0.13; 'wrote:': 0.15; 'operators,': 0.16; 'def': 0.16; 'math': 0.21; 'header:In-Reply-To:1': 0.22; 'stuff': 0.22; 'missed': 0.24; 'import': 0.29; 'skip:- 30': 0.30; 'object': 0.30; 'subject:?': 0.31; 'usual': 0.32; 'named': 0.32; 'to:addr:python- list': 0.34; 'header:User-Agent:1': 0.34; 'there': 0.34; 'file': 0.36; 'addition,': 0.36; 'but': 0.37; 'received:192': 0.38; 'subject:: ': 0.38; 'steven': 0.38; 'think': 0.38; 'received:192.168.1': 0.39; 'to:addr:python.org': 0.39; 'your': 0.60; 'customized': 0.76; '01:35': 0.84; 'can:': 0.91; 'something.': 0.91; 'subject:there': 0.91 |
| Date | Sat, 16 Jul 2011 08:56:44 -0700 |
| From | Gary Herron <gherron@islandtraining.com> |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Is there a way to customise math.sqrt(x) for some x? |
| References | <4e214d5a$0$29975$c3e8da3$5496439d@news.astraweb.com> |
| In-Reply-To | <4e214d5a$0$29975$c3e8da3$5496439d@news.astraweb.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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.1112.1310832355.1164.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1310832355 news.xs4all.nl 23979 [2001:888:2000:d::a6]:45605 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:9626 |
Show key headers only | View raw
On 07/16/2011 01:35 AM, Steven D'Aprano 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.
>
>
Create a file named myMath.py containing:
--------------------------------------
from math import *
def sqrt(x):
...whatever you want...
---------------------------------------
Then you can:
import math #to get normal stuff and
import myMath # to get your customized stuff
or
import myMath as math # to get your stuff but named math.
Gary Herron
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