News for hackers. Stuff that matters.
Re:Python Type Hints – *args and **kwargs by Syntaf on Sunday August 27, 2023 @10:26AM (#37283034)
Especially when they don't even leave a doc string so you're forced to track down the packages documentation online just to interact with certain interfaces.

I work in a large python codebase, we have almost no usage of `*kwargs` beyond proxy methods because of the nature of how they obfuscate the real interface for other developers.

Re:Python Type Hints – *args and **kwargs by hqudsi on Sunday August 27, 2023 @10:53AM (#37283281)
When I was first starting out, a then senior engineer told me: "friends don't let other friends use kwargs".

That always stuck with me.

Re:Python Type Hints – *args and **kwargs by icedchai on Sunday August 27, 2023 @11:18AM (#37283491)
I once worked on a code base where we had *kwargs passed down 4 or 5 layers deep (not my idea.) It was a true joy.
Re:Python Type Hints – *args and **kwargs by akasakahakada on Sunday August 27, 2023 @11:29AM (#37283603)
This is literally me. It is a math program that can evaluate equations and generate code. 6 layers of heterogeneous data structure which the math operation being act on 1st layer has its effect down to 6th layer. Temporarily using *kwargs to make it works but still thinking what is the proper way to do it right.
Re:Python Type Hints – *args and **kwargs by crazydoggers on Sunday August 27, 2023 @12:13PM (#37284034)
Can you organize the data structures into classes or dataclasses?
Re:Python Type Hints – *args and **kwargs by akasakahakada on Sunday August 27, 2023 @12:34PM (#37284244)
Already doing this. The problem is there are 5 layers in between. Copy and paste the same docstring into all layers is doable but do not seem smart.
Re:Python Type Hints – *args and **kwargs by c32c33429009ed6 on Sunday August 27, 2023 @12:13PM (#37284035)
Out of interest, what sort of company/industry do you work in where you're able to work on this kind of thing?
Re:Python Type Hints – *args and **kwargs by nerdponx on Sunday August 27, 2023 @11:15AM (#37283469)
The worst is when someone puts **kwargs at the base of a class hierarchy, not only necessitating its use in subclasses (if you want to be strict about types) but also swallowing errors for no good reason. Fortunately I think this style is fading out as type hints become more popular.