News for hackers. Stuff that matters.
Re:Be wary of functions which take several parameters of the... by hprotagonist on Thursday September 26, 2019 @08:38PM (#21087308)
a way to avoid this in python that i quite like is to require keyword arguments:

  def foo(*, x, y):
      pass
  
  # you must do this
  foo(x=5, y=6)

  # you cannot do this
  foo(5,6)

  # and therefore you also may not
  foo(6,5)
This is a little autocratic but the other nice thing is that if you’re finding it really painful to use it means you should probably refactor anyway.
Re:Be wary of functions which take several parameters of the... by XJ6 on Friday September 27, 2019 @08:56AM (#21091370)
I prefer to let the IDE do this.

Developing C# in rider if you call `foo(a,b)` then it'll display as `foo(from: a, to: b)` in the IDE.

Re:Be wary of functions which take several parameters of the... by throwaway744678 on Friday September 27, 2019 @09:07AM (#21091485)
All Jetbrains IDE do this (AFAIK). One can even configure the cases when these are displayed (ie. only show the hints when there is an ambiguity)
Re:Be wary of functions which take several parameters of the... by hprotagonist on Friday September 27, 2019 @12:21PM (#21093602)
for my own uses, that's great.

I write my libraries like this because i want to beat my users into being explicit -- thus the "a little autocratic, but.." caveat.