Re: Good solutions for passing around large numbers of arguments in a layered architecture?

2010-06-14 Thread Jean-Michel Pichavant
Nathan Rice wrote: I've been running into a problem lately where I have an architecture like so: Main class -> facade/configuration class -> low level logic class. The main class is what the user interacts with. The facade/config class is responsible for loading and managing the lower level cl

Re: Good solutions for passing around large numbers of arguments in a layered architecture?

2010-06-11 Thread Stephen Hansen
On 6/11/10 10:00 AM, Nathan Rice wrote: > I've tried using args/kwargs, however I found it difficult to avoid > having arguments in my signature re-ordered, and it is also a source > of bugs. > > Has anyone come up with a good solution for dealing with arguments in > situations like this where you

Re: Good solutions for passing around large numbers of arguments in a layered architecture?

2010-06-11 Thread James Mills
On Sat, Jun 12, 2010 at 3:00 AM, Nathan Rice wrote: > I've tried using args/kwargs, however I found it difficult to avoid > having arguments in my signature re-ordered, and it is also a source > of bugs. > > Has anyone come up with a good solution for dealing with arguments in > situations like th

Good solutions for passing around large numbers of arguments in a layered architecture?

2010-06-11 Thread Nathan Rice
I've been running into a problem lately where I have an architecture like so: Main class -> facade/configuration class -> low level logic class. The main class is what the user interacts with. The facade/config class is responsible for loading and managing the lower level classes and providing a

Re: LARGE numbers

2005-11-11 Thread Tuvas
Well, as I'll be doing lots of multiplication, guess that GMPY is the way to go. I'll use DecInt only for converting to strings if I find anything interesting. This is all just kind of a theoretical aproach, but, it can be lots of fun. Who knows if Python'll help find the largest prime number ever?

Re: LARGE numbers

2005-11-11 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Python's native longs use Karatsuba multiplication with is O(n^1.585). > My early version of DecInt (BigDecimal) uses 4-way Toom-Cook ... Wow, cool! Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: LARGE numbers

2005-11-11 Thread casevh
Paul Rubin wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > As the author of gmpy, I'd like to point out that the speed difference > > isn't all that large, if all you're doing is ordinary arithmetic -- a > > few times at most (it can be better if you need some of GMP's > > functionality whi

Re: LARGE numbers

2005-11-11 Thread Scott David Daniels
multiplication. (in other words, Python is not N**2 for large numbers). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: LARGE numbers

2005-11-11 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > As the author of gmpy, I'd like to point out that the speed difference > isn't all that large, if all you're doing is ordinary arithmetic -- a > few times at most (it can be better if you need some of GMP's > functionality which gmpy exposes, such as prim

Re: LARGE numbers

2005-11-11 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > Python does support large numbers, but it's not very fast for such > large numbers. There is a Python module called GMPY that uses the GMP > (Gnu Multiple Precision) library for faster operations on large > numbers. As the author of gmpy

Re: LARGE numbers

2005-11-11 Thread casevh
Already done for next version. Tentatively, there will be a package called "ar" (Arbitrary Radix) and the module will be called BigInt. I'm also working on an arbitrary radix BigFloat module. Case -- http://mail.python.org/mailman/listinfo/python-list

Re: LARGE numbers

2005-11-11 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: > An early alpha-quality release is available at > http://home.comcast.net/~casevh/ Given the module named "Decimal" in Python 2.4, I'd suggest you to rename your library. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: LARGE numbers

2005-11-11 Thread Mike Meyer
"Tuvas" <[EMAIL PROTECTED]> writes: > I've been thinking about writing a program to generate the world's > largest prime numbers, just for the fun of it. This would require being > able to hold an 800 digit number into memory (25 megabits, or a > little over 3 megs of memory for just one varia

Re: LARGE numbers

2005-11-10 Thread casevh
For more information on how the largest prime number was found, see www.mersenne.org. Python does support large numbers, but it's not very fast for such large numbers. There is a Python module called GMPY that uses the GMP (Gnu Multiple Precision) library for faster operations on large nu

LARGE numbers

2005-11-10 Thread Tuvas
I've been thinking about writing a program to generate the world's largest prime numbers, just for the fun of it. This would require being able to hold an 800 digit number into memory (25 megabits, or a little over 3 megs of memory for just one variable...) I would also need several smaller var

Re: curious problem with large numbers

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 10:18:05 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >>>Aha! Same version (2.3.4): >>> >>>Idle: >>>>>> 1e1 >>>1.0 >>>>>> import struct; struct.pack('d', 1e1) >>>'\x00\x00\x00\x00\x00\x00\xf0?' >>>(which is actually 1.0) >

[Marshal Bug] Was Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
OK - I think this is it: My last post fingering pickle was almost but not quite right*. Actually the cuplrit is marshal, which produces the incorrect result that was noted. The bug has nothing to do with IDLE, except that it uses marshal for inter-process communication. Here's the failure cas

Re: curious problem with large numbers - Due to subprocess

2005-04-08 Thread Scott David Daniels
Michael Spencer wrote: Problem is associated with executing iteractive input in a subprocess. >python idle.py -n IDLE 1.1 No Subprocess >>> 1e1 1.#INF >>> Really good find. _very_ curious. Perhaps moving the float causes the problem? Where does the value get converted to text

Re: curious problem with large numbers - Due to subprocess - using pickle

2005-04-08 Thread Michael Spencer
Michael Spencer wrote: Problem is associated with executing iteractive input in a subprocess. >python idle.py -n IDLE 1.1 No Subprocess >>> 1e1 1.#INF >>> Michael It seems that the culprit is pickle - used to send messages between the IDLE shell and the execution server. >

Re: curious problem with large numbers - Due to subprocess

2005-04-08 Thread Michael Spencer
Scott David Daniels wrote: Scott David Daniels wrote: Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Scott David Daniels wrote: Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1 1.#INF >>> import struct

Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
Scott David Daniels wrote: Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1 1.#INF >>> import struct; struct.pack('d', 1e1)

Re: curious problem with large numbers

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 09:05:39 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: >> Scott David Daniels wrote: >> >>> Terry Reedy wrote: >>> On my Windows machine with 2.2.1, I get exactly what you expected: >>> 1e1 1.#INF ... If you g

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there

Re: curious problem with large numbers

2005-04-08 Thread Ivan Van Laningham
Hi All-- Windows XP, uwin running on Athlon XP 3000+: 0 [/c/users/ivanlan][1] python Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> 1e1 1.#INF >>> Metta, Ivan Michael Spencer wrote: > >

Re: curious problem with large numbers

2005-04-08 Thread Sion Arrowsmith
Michael Spencer <[EMAIL PROTECTED]> wrote: >Terry Reedy wrote: >> "Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote >>>However, on Windows (have tried on Mac, Linux) I get the following >>>behaviour: >>inf = 1e1 >>inf >>>1.0 >> On my Windows machine with 2.2.1, I get exactly what you expec

Re: curious problem with large numbers

2005-04-08 Thread Dan Bishop
Chris Fonnesbeck wrote: > I have been developing a python module for Markov chain Monte Carlo > estimation, in which I frequently compare variable values with a very > large number, that I arbitrarily define as: > > inf = 1e1 Don't forget that you can write your own Infinity. (Warning: Buggy

Re: curious problem with large numbers

2005-04-07 Thread Michael Spencer
Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also the

Re: curious problem with large numbers

2005-04-07 Thread Steve Holden
Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there for 2.3.4 (May 25

Re: curious problem with large numbers

2005-04-07 Thread Michael Spencer
Terry Reedy wrote: "Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] However, on Windows (have tried on Mac, Linux) I get the following behaviour: inf = 1e1 inf 1.0 while I would have expected: 1.#INF On my Windows machine with 2.2.1, I get exactly what you ex

Re: curious problem with large numbers

2005-04-07 Thread Scott David Daniels
Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there for 2.3.4 (May 25 2004, 21:17:02). This is no

Re: curious problem with large numbers

2005-04-07 Thread Terry Reedy
"Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > However, on Windows (have tried on Mac, Linux) I get the following > behaviour: > inf = 1e1 inf > 1.0 > > while I would have expected: > > 1.#INF On my Windows machine with 2.2.1, I get exactly what y

Re: curious problem with large numbers

2005-04-07 Thread Laszlo Zsolt Nagy
I thought it will be the same for FreeBSD, but here are the results: FreeBSD 4.8 with Python 2.3.4 Python 2.3.4 (#2, Nov 10 2004, 05:08:39) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> inf = 1e308*2 >>> inf Inf >>> float('Inf

Re: curious problem with large numbers

2005-04-07 Thread Kristian Zoerhoff
On Apr 7, 2005 3:34 PM, David M. Cooke > > I don't do Windows, so I can't say this will work, but try > > >>> inf = 1e308*2 I *do* do Windows, and that does work. The value of inf then becomes '1.#INF' as expected. Strangely, doing float('1.#INF') still fails on Windows. Weird, weird. -- Kr

Re: curious problem with large numbers

2005-04-07 Thread David M. Cooke
Chris Fonnesbeck <[EMAIL PROTECTED]> writes: > I have been developing a python module for Markov chain Monte Carlo > estimation, in which I frequently compare variable values with a very > large number, that I arbitrarily define as: > > inf = 1e1 > > However, on Windows (have tried on Mac, Lin

Re: curious problem with large numbers

2005-04-07 Thread Jeff Epler
You may want to read http://www.python.org/peps/pep-0754.html Part of the text reads The IEEE 754 standard defines a set of binary representations and algorithmic rules for floating point arithmetic. Included in the standard is a set of constants for representing special values, in

curious problem with large numbers

2005-04-07 Thread Chris Fonnesbeck
I have been developing a python module for Markov chain Monte Carlo estimation, in which I frequently compare variable values with a very large number, that I arbitrarily define as: inf = 1e1 However, on Windows (have tried on Mac, Linux) I get the following behaviour: >>> inf = 1e1 >>>