Tagged articles
default-arguments
16 articles · Page 1 of 1
This article compares Python's literal [] and the list() constructor, examining their speed differences, readability implications, default‑argument pitfalls, object identity, and appropriate use cases such as creating empty lists, converting iterables, and avoiding mutable default parameters.
ListPythondefault-arguments
0 likes · 8 min read
![When to Use [] vs list() in Python: Performance, Readability, and Pitfalls](https://wsrv.nl/?url=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FbA6ibvWzutIY5AsAniajmLw1egwntyMDppXmqCee0Kc9vAlQPGgnujyQ5RysBuQS1FzHsicdUaiahmSKU3taA6Rh4A%2F0%3Fwx_fmt%3Djpeg)
This article explains C++ default arguments and inline functions, covering their definitions, syntax, rules, practical code examples, advantages, appropriate use cases, and key considerations, and compares the two features to help developers write clearer and more efficient code.
C++default-argumentsinline functions
0 likes · 5 min read

This guide walks through ten Python function‑argument examples—including positional, keyword, default values, mutable‑default pitfalls, variable‑length *args and **kwargs, argument unpacking, ordering rules, and mutable‑object handling—providing clear code snippets and explanations for each case.
Pythonargs-kwargsargument-unpacking
0 likes · 7 min read

This guide explains how to define Python functions, the role of return statements, differences between positional and keyword arguments, default‑parameter pitfalls, *args/**kwargs usage, argument unpacking, reference passing semantics, positional‑only/keyword‑only parameters, and anonymous lambda functions, all with clear code examples.
ParametersPythonargs-kwargs
0 likes · 6 min read

This article explores six frequently misunderstood Python features—mutable default arguments, the difference between is and ==, *args/**kwargs, iterator exhaustion, complex list comprehensions, and the global keyword—explaining why they trip developers up and offering clear, practical solutions to master each one.
Pythonargs-kwargsdefault-arguments
0 likes · 8 min read

This article explains PHP function parameter passing, covering pass‑by‑value versus pass‑by‑reference, how to define functions with multiple, default, and variable‑length arguments, and provides clear code examples illustrating each technique for backend developers.
Function ParametersPHPPass by Reference
0 likes · 4 min read

A detailed post‑mortem of Digg's disastrous v4 launch reveals how a Python function with a mutable default argument caused massive cache overloads, forced emergency fixes, and ultimately contributed to the company's downfall, offering crucial lessons for backend engineers on safe defaults and release planning.
BackendPythonbug
0 likes · 9 min read

The article recounts how a mutable default argument bug in a Python function caused Digg's v4 release to crash, leading to massive performance issues, costly downtime, and ultimately contributing to the company's decline, illustrating key lessons for backend developers.
Backendbugdefault-arguments
0 likes · 9 min read

A real‑world incident at Digg shows how using a mutable default argument in a Python function caused a cascade of performance problems, leading to a rushed v4 release, service outages, and ultimately the company's decline and acquisition.
BackendPythonbug
0 likes · 9 min read

This article explains three frequent Python pitfalls—using mutable objects as default arguments, unintentionally sharing class variables, and writing incorrect exception clauses—illustrates the problematic behavior with code examples, and provides the proper patterns to avoid each issue.
Class VariablesPythondefault-arguments
0 likes · 5 min read

This article walks through seven tricky Python snippets—default mutable arguments, lambda closures, class variable inheritance, division differences between Python 2 and 3, out‑of‑range slicing, list multiplication side effects, selective list comprehensions, and custom dict subclasses—explaining their outputs and how to fix them.
Class Variablesclosuresdefault-arguments
0 likes · 12 min read

This article explains why mutable default arguments share state, how Python closures cause late binding issues, the inheritance rules of class variables, differences between division operators in Python 2 and 3, list slicing behavior, list multiplication references, list comprehensions for even-indexed values, and custom dict subclasses with __missing__.
Class VariablesPythonclosures
0 likes · 11 min read

This article provides a comprehensive guide to Python functions, covering basic definitions, various parameter types—including default, positional, keyword, variable arguments and keyword‑only parameters—common pitfalls, recursion, lambda expressions, and best practices for clean, reusable code.
ParametersPythondefault-arguments
0 likes · 14 min read

This article walks through several puzzling Python code snippets, explaining why default mutable arguments share state, how closures suffer from late binding, the inheritance of class variables, differences in division between Python 2 and 3, list slicing quirks, and how list multiplication creates shared references, while also offering corrected implementations.
Class VariablesPythonclosures
0 likes · 12 min read

This article reviews ten frequent Python programming errors—including mutable default arguments, class variable misuse, incorrect exception handling, variable scope pitfalls, list mutation during iteration, closure late binding, circular imports, naming conflicts, Python 2/3 differences, and improper use of del—providing clear explanations and practical solutions to help developers write more reliable code.
Best PracticesPythoncommon mistakes
0 likes · 14 min read

This article explains why using a mutable object as a Python function's default value leads to unexpected behavior, illustrates the problem with concrete examples, and provides reliable solutions to avoid such subtle bugs.
Pythonbugsdefault-arguments
0 likes · 5 min read
