Growing pains for typing in Python
Growing pains for typing in Python
Posted Jan 19, 2024 16:41 UTC (Fri) by aigarius (subscriber, #7329)In reply to: Growing pains for typing in Python by pizza
Parent article: Growing pains for typing in Python
A person needs to determine if there is a *logical* sense in *how* function B is using methods on class A. No type system can tell you that.
And those can be really simple things, like sorting objects in ascending order or serialization them to JSON for RPC calls.
I just hit one such case today, that is broken right now inside the Python standard library. If you use pathlib Path objects and construct a complex, multilevel dict with the Path objects somewhere in the structure and then try to pass this structure to another server via jsonrpc call, well the whole thing comes crashing down because the Path objects are not JSON-serializable. Even if they are just used as a fancier proxy for simple text strings. If you use fancy types you get punished with fancy failures.
