Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22207

Re: why did GMPY change the names of its functions?

From casevh@gmail.com
Newsgroups comp.lang.python
Subject Re: why did GMPY change the names of its functions?
Date 2012-03-26 11:33 -0700
Organization http://groups.google.com
Message-ID <29431928.122.1332786797588.JavaMail.geo-discussion-forums@pbcjk1> (permalink)
References <39ff04b9-84a0-401c-a0a5-75e33cf59bc8@vy9g2000pbc.googlegroups.com>

Show all headers | View raw


On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote:
> OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
> 
> But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
> 
> What's the justification for that? I use those functions extensively
> in my library of Collatz utilities  and I had to re-edit them for no
> obvious reason.

I'll speak up as the maintainer of GMPY and GMPY2.

(My comments apply to the beta1 release which should be out in a couple of days.)

GMPY2 introduces many changes: 

1) the limited "mpf" type that is based on GMP has been replaced with the "mpfr" type from the MPFR library
2) support for multiple-precision complex arithmetic based on the MPC library
3) support for a mutable integer type optimized for in-place bit manipulations
4) support for addition number theory functions (generalized Lucas sequences and more primality tests

I began to encounter name collisions; for example, should sqrt() only return integer square roots. I chose to call it a new name (gmpy2) and update the API to reflect new choices I made. For example, sqrt() now returns an "mpfr" and isqrt() returns an "mpz".

As part of the documentation for the beta release, I will document the name changes. "import gmpy2 as gmpy; gmpy.scan0=gmpy.bit_scan0; etc" should work just fine.

If you encounter problems with the alpha release, please open an issue on gmpy's site.

Thanks,
casevh



On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote:
> OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
> 
> But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
> 
> What's the justification for that? I use those functions extensively
> in my library of Collatz utilities  and I had to re-edit them for no
> obvious reason.



On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote:
> OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
> 
> But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
> 
> What's the justification for that? I use those functions extensively
> in my library of Collatz utilities  and I had to re-edit them for no
> obvious reason.



On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote:
> OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
> 
> But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
> 
> What's the justification for that? I use those functions extensively
> in my library of Collatz utilities  and I had to re-edit them for no
> obvious reason.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

why did GMPY change the names of its functions? Mensanator <mensanator@aol.com> - 2012-03-25 21:59 -0700
  Re: why did GMPY change the names of its functions? alex23 <wuwei23@gmail.com> - 2012-03-25 22:43 -0700
  Re: why did GMPY change the names of its functions? Terry Reedy <tjreedy@udel.edu> - 2012-03-26 11:39 -0400
    Re: why did GMPY change the names of its functions? Mensanator <mensanator@aol.com> - 2012-03-26 11:27 -0700
  Re: why did GMPY change the names of its functions? casevh@gmail.com - 2012-03-26 11:33 -0700
    Re: why did GMPY change the names of its functions? Mensanator <mensanator@aol.com> - 2012-03-26 22:39 -0700

csiph-web