473,465 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why long integers

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)
Jul 18 '05 #1
1 1476
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/

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: S.Susnjar | last post by:
Hello all, I have been programming in Python only for a month or so and have stumbled over a "problem" that I could not solve through rtfm. $ python Python 2.2.2 (#1, Nov 6 2003, 09:19:47) ...
83
by: kartik | last post by:
there seems to be a serious problem with allowing numbers to grow in a nearly unbounded manner, as int/long unification does: it hides bugs. most of the time, i expect my numbers to be small. 2**31...
13
by: Jeff Melvaine | last post by:
I note that I can write expressions like "1 << 100" and the result is stored as a long integer, which means it is stored as an integer of arbitrary length. I may need to use a large number of...
9
by: w3r3w0lf | last post by:
hello! I have a following situation: I have a byte array where at a certain location are stored 4 bytes, and these should be "put" into long variable (or any other 4 byte one). ie: byte...
12
by: jose luis fernandez diaz | last post by:
Hi, My OS is: cronos:jdiaz:tmp>uname -a HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license I compile in 64-bits mode the program below:
8
by: Gopal | last post by:
Hello: Can anybody suggest a code or modify the following chunk of code for converting a decimal to BCD and viceversa for unsigned long integers. The following code works good for integers but...
14
by: ritesh.noronha | last post by:
Hi, I am a beginer programmer, i would like to know the exact difference between long and int. Why do we have two names for the same size of variable. Does the size of long and int change on...
6
by: vicky_in | last post by:
hi is anyone tell me any idea about to add 2 integers having more than 20 digits. e.g. 125865235989523352897956+565896589795623968955632.
4
by: parag_paul | last post by:
hi All I understand the need for long long , but what is the purpose of long as a data type separately. Just makes the language intimidating to start with, when you have to deal with so many data...
8
by: d major | last post by:
I was very puzzled about the conversion between float and long, I cann't understand why a long val can convert to a float, as the below codes show: typedef unsigned long u_long; float val =...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.