4 ms·
> Function signatures become horrendous lists of xxx:yyy->zzz I get it, I used to think this way when type hints were first introduced. I then tried them and c
by nicolaslem 3y ago
> Function signatures become horrendous lists of xxx:yyy->zzz
I get it, I used to think this way when type hints were first introduced. I then tried them and completely embraced them.
I maintain a fairly large and old code base in Python where half the code has type hints and the other half doesn't. The half without type hints may look cleaner to read but so much harder to understand when every argument has to be inferred from context.
- svilen_dobrev 3y agostill, that's all hints. What the argument/attribute gonna be at runtime, is .. a guess (maybe with 99% probability what is expected but may also be not). So one gets a hint (in syntax instead of comment saying so) plus a false feeling of assurance of something. i have no problem with the notion of variable anotations, it is wildly useful for many things.. but sparingly.. and not for "static typing" illusion. Python does have real strong types (so you cannot easily replace the type of some object with some other type without anyone noticing, ala (int)(void)(char)x stuff.. but that's nothing to do with this. >> Function signatures become horrendous lists of xxx:yyy->zzz as example that i recently stumbled upon - fastapi, and few others in its vicinity. Seems IDE-fancy-ability trumps common sense. But anyway.