[Python-ideas] Including elementary mathematical functions in the python data model

Antoine Pitrou solipsis at pitrou.net
Sun Sep 26 14:38:46 CEST 2010


On Sun, 26 Sep 2010 22:34:06 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Sun, Sep 26, 2010 at 10:25 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> >> Couple that with the extra function call overhead (since these
> >> wouldn't have real typeslots) and it still seems like a less than
> >> stellar idea.
> >>
> >> As another use case for solid, efficient generic function support
> >> though... great idea :)
> >
> > At the cost of even more execution overhead? :)
> 
> I did put that "efficient" in there for a reason! Now, I'm not saying
> anything about how *reasonable* that idea is, but I can dream ;)

Well, I can't see how it could be less than the overhead involved in a
sqrt(x) -> x.__sqrt__() indirection anyway.

When I read Mark's example, I wondered why he didn't simply write
x**0.5 instead of sqrt(x), but it turns out it doesn't work on
decimals.

cheers

Antoine.





More information about the Python-ideas mailing list