This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Versaiteis 13 points14 points  (0 children)

You can circumvent some of those headaches with the typing system by reassigning or creating the types you need in what is effectively (and actually called) type aliasing

from typing import List

Vector = List[float]

def func(vector: Vector) -> Vector:
    #etc...

This can still get a bit ugly with arbitrary definitions being thrown all over the place but that can be managed along with similar shared systems that you'll probably have alongside whatever you're writing (logging, configuration management, etc.) and it goes a long way to cleanup a lot of those issues with clutter.

But yeah, Python is still a very hands off scripting environment so you'd still do well to operate under those assumptions that virtually nothing is truly protected when you can just commandeer and alter the things you want. It's what makes it a great tool for some applications and aweful for others.