4.2. Standard Types

  • Numbers (four separate sub-types)

    • Regular or “Plain” Integer

    • Long Integer

    • Floating Point Real Number

    • Complex Number

  • String

  • List

  • Tuple

  • Dictionary

We will also refer to standard types as “primitive data types” in this text because these types represent the primitive data types that Python provides. We will go over each one in detail in Chapters 5, 6 and 7.

CORE NOTE: Standard types are not classes

In Java, although primitive data types are supported, they usually come in class “wrappers” for which instances are created when a data type is needed. In Python, standard types are not classes, so creating integers and strings does not involve instantiation. That also means that you cannot subclass a standard type either, although there is nothing wrong with wrapping a type around a Python class and modifying a class to what you desire. Python also provides some classes which emulate types and can be subclassed. See Section 13.18.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset