Python3: Mutable, Immutable… everything is object!

Introduction

Función Python id ()

Python type()

OUTPUT
  1. Mutable and immutable objects are handled differently in python. Immutable objects are quicker to access and are expensive to change because it involves the creation of a copy.
    Whereas mutable objects are easy to change.
  2. Use of mutable objects is recommended when there is a need to change the size or content of the object.
  3. Exception : However, there is an exception in immutability as well. We know that tuple in python is immutable. But the tuple consists of a sequence of names with unchangeable bindings to objects.
    Consider a tuple.
  • tup = ([3, 4, 5], ‘myname’)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store