Why do integers in database row tuple have an 'L' suffix?

octopusgrabbus :

My question is why do a MySQL row's integer values have an 'L' suffix? Here are the details:

The following dictionary -- artificially formatted here for ease of display --

{'estimated': '', 
 'suffix': '', 
 'typeofread': 'g', 
  'acct_no': 901001000L, 
  'counter': 0, 
  'time_billed': datetime.datetime(2012, 5, 1, 9, 5, 33), 
  'date_read': datetime.datetime(2012, 3, 13, 23, 19, 45), 
  'reading': 3018L, 
  'meter_num': '26174200'}

is comprised of a MySQL database table's columns zipped with the result of reading once from the table.

I can remove the 'L' by passing these values into int(), so if that dictionary were in a variable named snapped_read, I could do this:

int(snapped_read['reading']) and 3018L would change to 3018.

I'm just curious as to why integers show up this way.

JAB :

Because in versions of Python before Python 3, long integer literals were indicated with an l or L suffix. In Python 3, ints and longs have been merged into just int, which functions pretty much like long used to.

Do note that, technically, Python( 2)'s int was equivalent to C's long, while Python's long was more like a BigNumber-type thing with unlimited precision (which is now the case for Python 3's int type.)

http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why do some Linux files have a 'd' suffix?

From Dev

Why integers do not have size limit in python 3?

From Dev

Why do I have to perform cast to object inside value tuple?

From Dev

Given a table with a varchar column, return the entries that do not have any suffix in a different row

From Dev

Why do I get this error: TypeError: tuple indices must be integers or slices, not str

From Dev

Why do some Debian packages have a "+deb7u2" suffix?

From Dev

Why do all type_traits Classes have to be called using 'typename' and '::type' Prefix/Suffix?

From Java

Why does java have no byte type suffix?

From Dev

Why are web protocols designed to have :// suffix?

From Dev

how do I convert a tuple of floats to a tuple of integers

From Dev

Why do I have extra space in a grid row?

From Dev

Why do I get a null row in my sqlite database in flask?

From Dev

Literal suffix for small integers

From Dev

Why does any row I insert into my AWS Postgres database (with psycopg2) immediately become a dead tuple?

From Dev

Why does the class in Intent have the "::class.java" suffix?

From Dev

Do tuple implementations have an optimized layout?

From Dev

How do I scanf a row of n integers?

From Dev

What do I wrong comparing a tuple of integers in PureScript?

From Dev

Why do I have a space between the top row and the navbar using Bootstrap 4?

From Dev

Why do I have more row after the left merge and drop_duplciates()?

From Dev

Why do integers in PowerShell compare by digits?

From Dev

Why do integers not conform to the AnyObject protocol?

From Dev

Why do my integers add like strings

From Dev

Java: Atomic tuple of integers

From Dev

Tuple Comparison with Integers

From Dev

Why would R use the "L" suffix to denote an integer?

From Dev

Why do i need library file with -sources suffix?

From Dev

Why a tuple doesn't have parameterless constructor while `[Serializable]`?

From Dev

Why this two different implementations of Tuple have a different size?

Related Related

  1. 1

    Why do some Linux files have a 'd' suffix?

  2. 2

    Why integers do not have size limit in python 3?

  3. 3

    Why do I have to perform cast to object inside value tuple?

  4. 4

    Given a table with a varchar column, return the entries that do not have any suffix in a different row

  5. 5

    Why do I get this error: TypeError: tuple indices must be integers or slices, not str

  6. 6

    Why do some Debian packages have a "+deb7u2" suffix?

  7. 7

    Why do all type_traits Classes have to be called using 'typename' and '::type' Prefix/Suffix?

  8. 8

    Why does java have no byte type suffix?

  9. 9

    Why are web protocols designed to have :// suffix?

  10. 10

    how do I convert a tuple of floats to a tuple of integers

  11. 11

    Why do I have extra space in a grid row?

  12. 12

    Why do I get a null row in my sqlite database in flask?

  13. 13

    Literal suffix for small integers

  14. 14

    Why does any row I insert into my AWS Postgres database (with psycopg2) immediately become a dead tuple?

  15. 15

    Why does the class in Intent have the "::class.java" suffix?

  16. 16

    Do tuple implementations have an optimized layout?

  17. 17

    How do I scanf a row of n integers?

  18. 18

    What do I wrong comparing a tuple of integers in PureScript?

  19. 19

    Why do I have a space between the top row and the navbar using Bootstrap 4?

  20. 20

    Why do I have more row after the left merge and drop_duplciates()?

  21. 21

    Why do integers in PowerShell compare by digits?

  22. 22

    Why do integers not conform to the AnyObject protocol?

  23. 23

    Why do my integers add like strings

  24. 24

    Java: Atomic tuple of integers

  25. 25

    Tuple Comparison with Integers

  26. 26

    Why would R use the "L" suffix to denote an integer?

  27. 27

    Why do i need library file with -sources suffix?

  28. 28

    Why a tuple doesn't have parameterless constructor while `[Serializable]`?

  29. 29

    Why this two different implementations of Tuple have a different size?

HotTag

Archive