Python 3 type hints in Plone

How much shitposting is allowed on this thread? I want python 3 type hints in Plone because I want to create even more reasons for CI tests to fail, and make them nearly impossible to pass without having a PhD.

1 Like

Mission impossible.

“Never promise to do the possible. Anyone could do the possible. You should promise to do the impossible, because sometimes the impossible was possible, if you could find the right way, and at least you could often extend the limits of the possible. And if you failed, well, it had been impossible.”

― Terry Pratchett, Going Postal

“It is well known that a vital ingredient of success is not knowing that what you're attempting can't be done. A person ignorant of the possibility of failure can be a half-brick in the path of the bicycle of history.”
― Terry Pratchett, Equal Rites

Sorry, enough... I thought it was funny at least.

There's a quote somewhere in that series about Professors handing out impossible problems to Graduate Students because the student's don't yet 'know' that the problem is impossible to solve. Therefore, the students sometimes come up with crazy solutions to problems once thought of as impossible. (the professor gets all the credit too)

I thought it relevant to GSOC assignments.

Edit: I also like arguing with @zopyx because he's an incredibly tough opponent to argue against.


Just for two reasons:

  • the codebase of Plone and Zope is huge
  • adding typing hints even for smaller frameworks is huge and a risky undertaking

My 2 cents on type annotations: they are useful if they provide real-world advantages for project.
In my current project, I learned a lot in the context of type hints and I learned what is useful (for me) and what is not:

  • type hints in the context of Pydantic models are extremely useful for type safety, validation purposes and other constraints. I really do not want to pass dict-styles configurations around without semantics being associated with such an untyped data structure
  • Typeguard plugin for pytest is extremely useful for checking type annotations as part of your tests, in particular in the context of 100% test coverage.
  • For public API methods, I often use Typeguard for enforcing type checks at runtime..this takes some extra time but provides a lot of extra safety against bad data (integers disguised as strings etc.)
  • "mypy" is pretty much a useless tools for my own projects. Yes, mypy can find issues in your code but it generates a lot of noise and a lot of false positives. Fixing mypy issues can be hard - just for the reason to make mypy shut up. mypy is also major pain when you deal with external libraries with typing annoations (to mention: Pandas, Numpy)..a lot of noise.

None. It is impossible.