Object Internals In Python

Mridu Bhatnagar (~mridu)


2

Votes

Description:

This talk is intended to explain to participants what is happening under the hood when they are playing around with different python built-in data structures. Some fun and confusing examples along the way.

Pre-requisites: Anyone who knows built-in python data structures like List, Dictionaries, set, etc.

Curiosity questions that the talk answers:

  1. What happens to the memory address when * operator is used?
  2. When does python create a new object in memory?
  3. What does it refer to the mutability and immutability of objects in Python?
  4. If the outer object is immutable but the reference objects are mutable. Can the elements be added?
  5. What is the difference at the memory level when we refer to deep copy and shallow copy in lists?
  6. Operations like List.sort and sorted in python? What to use, when to use? What happens at the memory level?
  7. What is the difference between is vs ==? When should it be used?
  8. Lots and lots of interesting examples.
  9. How do we determine the memory reference id associated with the object?
  10. Meaning of assigning a value to a variable in Python.

Outline:

  • objects 1 min
  • types of objects (mutable, immutable) 2-3 min
  • memory address ( id() method) 1 min
  • difference between is operator vs == operator 5 minutes
  • memory optimization
    • difference between sort() and sorted() built-in method at memory level 2 min
    • concept of integer caching 2 min
    • string interning 5 min
  • concept of shallow copy and deep copy in lists 5 min
  • Why it is important to learn these concepts 3 min
  • conclusion 1 min

Prerequisites:

  • Basic understanding of built-in Python Data Structures
  • Familiarity with basic Python programming.

Video URL:

https://www.youtube.com/watch?v=5TMoywv5eKQ&t=394s

Speaker Info:

Mridu is a Python Developer. She enjoys converting ideas into working applications. She loves giving talks at various community meetups and conferences.

Speaker Links:

  • Twitter-https://twitter.com/Mridu__
  • Github-https://github.com/mridubhatnagar
  • Blog - https://dev.to/mridubhatnagar
  • Published Blogs
    • https://www.twilio.com/blog/build-vocabulary-bot-whatsapp-python-twilio
    • https://www.twilio.com/blog/word-of-the-day-sms-python-twilio
  • List of Talks Delivered - https://hackmd.io/@tUEElFgvTmK75sO7Q-3_5g/rkCeJsCoL

Section: Core Python
Type: Talks
Target Audience: Intermediate
Last Updated: