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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay