61
slicing arrays (hexbear.net)
submitted 3 months ago by Owl@hexbear.net to c/technology@hexbear.net
you are viewing a single comment's thread
view the rest of the comments
[-] edge@hexbear.net 6 points 3 months ago

Those are in no way incompatible.

[-] invalidusernamelol@hexbear.net 3 points 3 months ago* (last edited 3 months ago)

You just have to do it manually in Python or rely on systems like mypy to get 'static' checking.

It can be useful to rely on duck typing though if you don't want to have to re-implement or inherit from an existing base class to use a higer order function.

If the function is written in a way where all it needs is specific methods or parameters from its input objects, you can really save on interface bloat.

But if someone is used to writing statically typed code and has to deal with that it can create a lot of confusion and I always end up writing a ton of override signatures either in my code or in a .pyi sidecar so whoever is using it can still get some form of feedback that what they're doing is okay. Or at the very least putting that information in the docstring so people can read the docs as they're using the function.

[-] comrade_pibb@hexbear.net 3 points 3 months ago

Of course not, the syntax is making the type system obvious tho

this post was submitted on 13 Jul 2024
61 points (98.4% liked)

technology

23238 readers
260 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 4 years ago
MODERATORS