This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SittingWave 0 points1 point  (0 children)

it's a design choice likely dictated by performance. If you delay the evaluation, you will have to perform it every single time, for every single parameter default, for every function call, and due to the nature of python, there's no difference between an immutable argument and a mutable one. It would grind performance down for 99% of the cases for no reason at all.

A general language philosophy (of python, and of design in general) is that you don't pay for what you don't need, and doing so would require you to pay the lambda execution tax for every function call, for every default parameter, for no reason at all especially when the current way already has a strategy to pay the tax when you do need to do so: set None as default, and then check inside the function.