Objects in Python

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Aug 25 07:01:07 EDT 2012


On 25/08/2012 11:23, Chris Angelico wrote:
> On Sat, Aug 25, 2012 at 6:55 PM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
>> I'm just wondering out aloud if the number of times this type of thread has
>> been debated here will fit into a Python long or float?
>
> Well, when I have to store currency information, I like to store it as
> an integer, using the native currency's "small unit" (eg the cent in
> dollar+cent currencies). In this instance, instead of trying to count
> the threads (which would be fractional), just count the number of
> posts. It then is an integer, and I've yet to find any integer that
> can't be represented as a Python long (or, in 3.x, int).
>
> ChrisA
>

That could have been fun in the good old days of pounds, shillings and 
pence.  Why they had to complicate things by going decimal I shall never 
know.  Bring back simplistic imperial measures for everything, that's 
what I say.

Using long just shows I've still got a Python 2 hat on.  Still when 
those fine people who develop Matplotlib deliver 1.2 with its Py3k 
compliance, aided or hindered by me testing on Windows, Python 3.3 here 
I come.

I suppose an alternative to long (or int) or float would have been the 
Decimal class from the decimal module?  Opinions on this anybody?

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list