Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Forget about production, how did this make it into python? This is so unbelievably stupid it makes PHP look like a sensible language.


This is the question people should be asking rather than trying to identify which Digg employee should be retroactively thrown under the bus. Just a completely insane design decision.


This is one of those things that are so bad it warrants breaking backwards compability, possibly by releasing a python v4.


If they start today they could complete the migration by the mid-2040s!


It's one of the top python posts on S/O, every python developer finds their way to this discovery https://stackoverflow.com/questions/1132941/least-astonishme...


It's an interesting decision to be sure. Then again it's not really that arcane, the question is simply whether you calculate function defaults once or on every invocation. Python made the choice to run it once.

What I don't get here is why they didn't simply use 'None' instead. If a parameter is optional then 'None' makes way more sense than an empty list.


It is perfectly sensible… if your language is guaranteed immutable everywhere


I suspect because it's easier to implement defaults as values than as expressions.

The scoping of list comprehensions in Python 2 was far less justifiable, IMO.


This. Should have been taken out in Python 3, but nah, still present even today.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: