DEV Community

Cover image for Introduction to Python data objects.
Kelechi Kizito Ugwu
Kelechi Kizito Ugwu

Posted on

Introduction to Python data objects.

Python expressions create and process objects. “Object” is essentially anything that you can assign to a variable.

Python’s core object types include;
Numbers
Strings
Lists
Dictionaries
Tuples
Files
Sets

Numbers are numerical data types which include; integers, floating-point numbers and more exotic numerical types(complex numbers).

Image description

Strings are textual data types as well as arbitrary collection of bytes. Strings are known as sequence —that is, a positionally ordered collection of other objects. They are enclosed in double or single quotation marks.

Image description

List is a positionally ordered sequence of arbitrary object types. They have no fixed size and are enclosed in square brackets.

Image description

Dictionaries are also known as mappings. Mappings store objects in a key-value pair. They are enclosed in curly brackets.

Image description

A tuple is a collection of objects which ordered and immutable. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets.

Image description

Files are python’s code interface into external files.

Image description

Set is an unordered and mutable collection of objects. Sets are enclosed in curly brackets.

Image description

Why use Object types?

-Object types make programs easy to write. With object types like Lists and Dictionaries which offer collections and search tables for free respectively make it easier to write programs.
-Built-in objects are often more efficient than custom data structures.
-Built-in objects are a standard part of the language.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay