^^Python. Built-in simple types.

**Python Scalar Types**

Type Example Description
int x = 1 integers (i.e., whole numbers)
float x = 1.0 floating-point numbers (i.e., real numbers)
complex x = 1 + 2j Complex numbers (i.e., numbers with real and imaginary part)
bool x = True Boolean: True/False values
str x = 'abc' String: characters or text
NoneType x = None Special object indicating nulls

Python integers

Python Floating-Point Numbers

can be defined either in standard decimal notation, or in exponential notation

1.06   or  106e-2     e or E.

An integer can be explicitly converted to a float with the float constructor:
float(1)
 1.0

ref: Floating point number.

>>> Strings, String Type. Python.

None Type. None  is the sole value of the type NoneType

None-Type has only a single possible value: None.

None is used in many places, most commonly as the default return value of a function.

Es any function in Python with no return value is, in reality, returning None.

None frequently used to represent the absence of a value. built-in_constants

isinstance(x, type(None))  equi   x is None

ref: realpython/null-in-python

Boolean Type

The Boolean type is a simple type with two possible values: True and False, and is returned by comparison operators.

True and False  are case sensitive, must be capitalized !

 

bool() object constructor constructs a boolean value

values of any other type can be converted to Boolean via predictable rules.

Es numeric type is False if equal to zero, and True otherwise:

bool(2014) >>> True
bool(0)    >>> False

For strings, bool(s) is False for empty strings and True otherwise.

 

reference/datamodel  Special method names / 3.3.1. Basic customization

 

object.__init__(self[, ...])

Called after the instance has been created (by __new__()), but before it is returned to the caller. The arguments are those passed to the class constructor expression.

object.__dict__

A dictionary or other mapping object used to store an object’s (writable) attributes.

object.__repr__(self)

Called by the repr() built-in function to compute the “official” string representation of an object.