Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9614
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: Is there a way to customise math.sqrt(x) for some x? |
| Date | 2011-07-16 11:37 +0200 |
| Organization | None |
| References | <4e214d5a$0$29975$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1107.1310809049.1164.python-list@python.org> (permalink) |
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.
There seem to be only three methods that can be customized:
$ grep 'LookupSpecial' mathmodule.c
method = _PyObject_LookupSpecial(number, "__ceil__", &ceil_str);
method = _PyObject_LookupSpecial(number, "__floor__", &floor_str);
trunc = _PyObject_LookupSpecial(number, "__trunc__", &trunc_str);
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