4 ms·
I am a Python programmer with a bit of Golang experience. If it were upto me I'd absolutely do away with default function arguments in Python. It is one of the
by pcwelder 2y ago
I am a Python programmer with a bit of Golang experience. If it were upto me I'd absolutely do away with default function arguments in Python.
It is one of the rules now I live by. I don't have to worry about leaving an argument during calling anymore.
I think it fits well with the pythonic mantra of explicit is better than implicit.
- margalabargala 2y agoDefault arguments being hidden/unclear/wrong/hard to find/undocumented is by far the #1 source of bugs I encounter in Python programs. It's not even close. Probably around 70%.
- lpribis 2y agoEven worse when you see function X takes some parameters and then passes *args and **kwargs to a client function. Makes the available (or required) parameters very difficult to track down.
- richrichie 2y agoI agree. But there are places it is clearly useful. pandas.read_csv is a good example.