Syntactic sugar to encourage use of named arguments

From my experience teaching beginners, and as a senior Python developer with a few 100K pythonic code under my belt, I think this is not something Python needs. If anything it will make keyword arguments harder to understand, not less.

For example beginners already have a hard time to grasp why keyword arguments need default values, and why it should be None unless good reasons, where as positional arguments don’t.

This change would need the opposite understanding, i.e. why positional arguments need be passsed by variable name, whereas keyword arguments take just the keyword but no assignment, despite of the = sign, which everywhere else always necessitates a left=right assignment.

In short, it will be confusing. Also it is at odds with a lot of Pythonic ideas:

  • it is not obvious,
  • it is not explicit,
  • it adds yet another way of doing things,
  • it is inconsistent with the use of = as the keyword=value syntax
  • it adds complexity
  • if is bad namespacing (renaming the variable in the calling context will break the code and it is not obvious to fix)

All things considered, I am not in favor of the idea.

31 Likes