Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #22154 > unrolled thread
| Started by | Mensanator <mensanator@aol.com> |
|---|---|
| First post | 2012-03-25 21:59 -0700 |
| Last post | 2012-03-26 22:39 -0700 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.python
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
| From | Mensanator <mensanator@aol.com> |
|---|---|
| Date | 2012-03-25 21:59 -0700 |
| Subject | why did GMPY change the names of its functions? |
| Message-ID | <39ff04b9-84a0-401c-a0a5-75e33cf59bc8@vy9g2000pbc.googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | alex23 <wuwei23@gmail.com> |
|---|---|
| Date | 2012-03-25 22:43 -0700 |
| Message-ID | <0a6ac762-963f-4bdf-8c06-df3a53699f2c@z5g2000pbu.googlegroups.com> |
| In reply to | #22154 |
On Mar 26, 2:59 pm, Mensanator <mensana...@aol.com> 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? Python is not gmpy. You might be better served asking the project maintainer(s). > 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. Well, the obvious reason is that it's a different version which offers no promise of API backwards compatibility.
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2012-03-26 11:39 -0400 |
| Message-ID | <mailman.1008.1332776385.3037.python-list@python.org> |
| In reply to | #22154 |
On 3/26/2012 12:59 AM, 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? Guess: Either the functions changed or they want to regularize their names. > 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. If GMPY is coded in Python with a C? backup, GMPY.scan0 = GMPY.bit_scan0 should work. Or you could write a GMPY.py wrapper for GMPY2 from GMPY2 import * scan0=bit_scan0 scan1=bit_scan1 <any other compatibility hacks> and leave your user code alone. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Mensanator <mensanator@aol.com> |
|---|---|
| Date | 2012-03-26 11:27 -0700 |
| Message-ID | <20665b28-a2ca-45ee-ba91-12481653d9a2@sv8g2000pbc.googlegroups.com> |
| In reply to | #22196 |
On Mar 26, 10:39 am, Terry Reedy <tjre...@udel.edu> wrote: > On 3/26/2012 12:59 AM, 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? > > Guess: Either the functions changed or they want to regularize their names. > > > 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. > > If GMPY is coded in Python with a C? backup, GMPY.scan0 = GMPY.bit_scan0 > should work. > > Or you could write a GMPY.py wrapper for GMPY2 > > from GMPY2 import * > scan0=bit_scan0 > scan1=bit_scan1 > <any other compatibility hacks> > > and leave your user code alone. > > -- > Terry Jan Reedy Oh, similar to an "import as", but this would allow me to change individual functions. Thanks.
[toc] | [prev] | [next] | [standalone]
| From | casevh@gmail.com |
|---|---|
| Date | 2012-03-26 11:33 -0700 |
| Message-ID | <29431928.122.1332786797588.JavaMail.geo-discussion-forums@pbcjk1> |
| In reply to | #22154 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Mensanator <mensanator@aol.com> |
|---|---|
| Date | 2012-03-26 22:39 -0700 |
| Message-ID | <f9966eb3-457b-4eab-a50d-e0c68aa3d595@w6g2000pbp.googlegroups.com> |
| In reply to | #22207 |
On Mar 26, 1:33 pm, cas...@gmail.com wrote: > 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 Thanks for the explanation. Sorry if I flew off the handle, but I've been sick recently and am trying to get back into Python after 2 years. I just bought a new laptop, downloaded Python 3.2 & GMPY2 only to see my Collatz library crash. At first, given my current condition, I was afraid I'd never get it to work again. But luckily, the fix is simple. I, for one, really appreciate your maintaining GMPY, otherwise, I might have to abandon Python. I'll keep my eyes open for any further problems. Thanks Gain. > > > > 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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web