added intro sentence. corrected spelling. (#21207)
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Python Integers
|
||||
---
|
||||
The theoretical domain for integers in python is negative infinity to infinity. In practice, integer values are limited by the amount of available memory.
|
||||
Integers are whole numbers with no decimal point. They include negative, zero, and positive numbers. The theoretical domain for integers in python is negative infinity to infinity. In practice, integer values are limited by the amount of available memory.
|
||||
|
||||
In Python 2, there was a distinction between **`int`**, numbers that fit in a 32 or 64 bit _C long_, and **`long`**, numbers limited by available memory. Python 3 unified the two types into just **`int`**, more info in <a href='https://www.python.org/dev/peps/pep-0237/' target='_blank' rel='nofollow'>PEP 237</a>.
|
||||
In Python 2, there was a distinction between **`int`**, numbers that fit in a 32 or 64 bit _C long_, and **`long`**, numbers limited by available memory. Python 3 unified the two types into just **`int`** (more info in <a href='https://www.python.org/dev/peps/pep-0237/' target='_blank' rel='nofollow'>PEP 237</a>).
|
||||
|
||||
**`int` creation using integer literals**
|
||||
|
||||
@ -23,7 +23,7 @@ Numeric literals do not contain a sign, however creating negative _integer objec
|
||||
>>> type(-1234567890)
|
||||
<class 'int'>
|
||||
|
||||
Likewise, positive integer objects can be created by prefixing a unary `+` (plus) operator with no space before the digits. Usually `+` is ommited:
|
||||
Likewise, positive integer objects can be created by prefixing a unary `+` (plus) operator with no space before the digits. Usually `+` is omitted:
|
||||
|
||||
>>> +1234
|
||||
1234
|
||||
@ -144,4 +144,4 @@ If a prefixed string and base 0 is used, the created integer object will use the
|
||||
>>> int('0b100', 0)
|
||||
4
|
||||
>>> int('0o100', 0)
|
||||
64
|
||||
64
|
||||
|
Reference in New Issue
Block a user