Nerodia Reference Manual

8.5. PyInt🔗

🔗def

A Python long object. That is, an instance of int.

🔗def

The Python integer type, int.

🔗opaque

Creates a Python integer from a Lean integer.

🔗def
Nerodia.PyInt.toInt (self : PyInt) : Int
Nerodia.PyInt.toInt (self : PyInt) : Int

Returns the integer value of self as a Lean Int.

🔗def

Creates a Python integer from a nonnegative Lean integer.

🔗def
Nerodia.PyInt.toNat? (self : PyInt) : Option Nat
Nerodia.PyInt.toNat? (self : PyInt) : Option Nat

Returns the integer value of self as a Lean Nat. If self is negative, returns none.

🔗def
Nerodia.mkPyFin {n : Nat} (m : Fin n) : CPyIO PyInt
Nerodia.mkPyFin {n : Nat} (m : Fin n) : CPyIO PyInt

Creates a Python integer from a bounded, nonnegative Lean integer.

🔗def
Nerodia.PyInt.toFin? {n : Nat} (self : PyInt) : Option (Fin n)
Nerodia.PyInt.toFin? {n : Nat} (self : PyInt) : Option (Fin n)

Returns the integer value of self as a Lean Fin. If self is negative or at least n, returns none.

🔗def

Creates a Python integer from a native signed word.

🔗def
Nerodia.PyInt.toISize? (self : PyInt) : Option ISize
Nerodia.PyInt.toISize? (self : PyInt) : Option ISize

Returns the integer value of self as a native signed word. If self is out of range, returns none.

🔗def

Creates a Python integer from a native unsigned word.

🔗def
Nerodia.PyInt.toUSize? (self : PyInt) : Option USize
Nerodia.PyInt.toUSize? (self : PyInt) : Option USize

Returns the integer value of self as a native unsigned word. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 64-bit signed integer.

🔗def
Nerodia.PyInt.toInt64? (self : PyInt) : Option Int64
Nerodia.PyInt.toInt64? (self : PyInt) : Option Int64

Returns the integer value of self as a native 64-bit signed integer. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 64-bit unsigned integer.

🔗def
Nerodia.PyInt.toUInt64? (self : PyInt) : Option UInt64
Nerodia.PyInt.toUInt64? (self : PyInt) : Option UInt64

Returns the integer value of self as a native 64-bit unsigned integer. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 32-bit signed integer.

🔗def
Nerodia.PyInt.toInt32? (self : PyInt) : Option Int32
Nerodia.PyInt.toInt32? (self : PyInt) : Option Int32

Returns the integer value of self as a native 32-bit signed integer. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 32-bit unsigned integer.

🔗def
Nerodia.PyInt.toUInt32? (self : PyInt) : Option UInt32
Nerodia.PyInt.toUInt32? (self : PyInt) : Option UInt32

Returns the integer value of self as a native 32-bit unsigned integer. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 16-bit signed integer.

🔗def
Nerodia.PyInt.toInt16? (self : PyInt) : Option Int16
Nerodia.PyInt.toInt16? (self : PyInt) : Option Int16

Returns the integer value of self as a native 16-bit signed integer. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 16-bit unsigned integer.

🔗def
Nerodia.PyInt.toUInt16? (self : PyInt) : Option UInt16
Nerodia.PyInt.toUInt16? (self : PyInt) : Option UInt16

Returns the integer value of self as a native 16-bit unsigned integer. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 8-bit signed integer (i.e., a byte).

🔗def
Nerodia.PyInt.toInt8? (self : PyInt) : Option Int8
Nerodia.PyInt.toInt8? (self : PyInt) : Option Int8

Returns the integer value of self as a native 8-bit signed integer. If self is out of range, returns none.

🔗def

Creates a Python integer from a native 8-bit unsigned integer (i.e., a byte).

🔗def
Nerodia.PyInt.toUInt8? (self : PyInt) : Option UInt8
Nerodia.PyInt.toUInt8? (self : PyInt) : Option UInt8

Returns the integer value of self as a native 8-bit unsigned integer. If self is out of range, returns none.