Geek Culture
Published in

Geek Culture

Do not use mutable objects as default arguments in Python

This Python peculiarity can lead to some unexpected behavior of your programs.

Say, you want a function that appends some data to a list. And if the list is not passed, then appends the same data to a newly created list.

--

--

--

A new tech publication by Start it up (https://medium.com/swlh).

Recommended from Medium

Create your own bug tracker system with ErrBit

Rocket Typist 1 3 — Expand Typed Abbreviations Printable

Rocket typist 1 3 – expand typed abbreviations printable worksheets

News:Global Serverless Architecture Market is estimated to reach USD 16.4 Billion in 2024

P5LIVE: Walking Through a Collaborative p5.js Environment for Live Coding

A photograph of a live performance. A person stands at a table with a laptop in a dark room. Around them is a projection of a P5LIVE window, which is vivid red and black, and looks like the windows are stacked on top of each other.

Product Strategy For Scale: Features

Hack Club Bank is now live for everyone, you included.

The idea behind “Concurrency is not parallelism”

Security in Dependencies

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
Timur Bakibayev

Timur Bakibayev

Professor, Ph.D. in CS, Almaty Management University

More from Medium

Why and How to Write Frozen Dataclasses in Python

How to compare and find difference between two Json object in python

Create a Multi-service Development Environment With VS Code and Docker

# Refactoring: Parallel change pattern with python