Why long integers

Discussion in 'Python' started by Joe Green, Oct 12, 2003.

  1. Joe Green

    Joe Green Guest

    I have been wondering why we have Long integers as a seperate type:

    import sys
    a=sys.maxint+1 # gives 2147483648L <- coerced to Long
    a=2147483648 # gives 2147483648L <- coerced to Long

    so the first question is: what is the point of the L in a=2147483648L ?
    and:

    a-=a #gives 0L

    what is the advantage (or point of) it remaining Long ?

    What I am tryinfg to say is, why is there not just an Integer type, which is
    normally 2 bytes, but expands AND contracts as necessary ?
    (Part of the explanation will be historical, but ignoring that)
    Joe Green, Oct 12, 2003
    #1
    1. Advertising

  2. Joe Green

    Gerrit Holl Guest

    Tim Peters wrote:
    > [Joe Green]
    > > I have been wondering why we have Long integers as a seperate type:
    > > ...

    >
    > Please see
    >
    > http://www.python.org/peps/pep-0237.html


    Why is it PEP 237 is not implemented using __future__?
    There are several incompatible changes: x<<n, 0xffffffff, etc.
    I am not a computer scientist so I do not understand why this
    behaved like it did in the past (nor do I really care), but being
    able to user a from __future__ import foo statement seems applicable
    here. Why hasn't it been applied here?

    regards,
    Gerrit Holl.

    --
    280. If while in a foreign country a man buy a male or female slave
    belonging to another of his own country; if when he return home the owner
    of the male or female slave recognize it: if the male or female slave be a
    native of the country, he shall give them back without any money.
    -- 1780 BC, Hammurabi, Code of Law
    --
    Asperger Syndroom - een persoonlijke benadering:
    http://people.nl.linux.org/~gerrit/
    Kom in verzet tegen dit kabinet:
    http://www.sp.nl/
    Gerrit Holl, Oct 13, 2003
    #2
    1. Advertising

  3. Gerrit Holl wrote:
    > Why is it PEP 237 is not implemented using __future__?


    Probably because they're not the kind of changes that
    you can choose to turn on or off on a per-module
    basis!

    --
    Greg Ewing, Computer Science Dept,
    University of Canterbury,
    Christchurch, New Zealand
    http://www.cosc.canterbury.ac.nz/~greg
    Greg Ewing (using news.cis.dfn.de), Oct 16, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    659
    Eric Sosman
    Jul 8, 2003
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,763
    Smokey Grindel
    Dec 2, 2006
  3. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,179
    Peter Shaggy Haywood
    Sep 20, 2005
  4. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    462
    santosh
    Jul 24, 2007
  5. Oliver Graeser
    Replies:
    10
    Views:
    574
    Oliver Graeser
    Sep 26, 2008
Loading...

Share This Page