12
Protocols in Python (til.simonwillison.net)
you are viewing a single comment's thread
view the rest of the comments
[-] lysdexic@programming.dev 2 points 1 year ago

It’s very weird to me that Python, as an inherently untyped language

I don't think this is true. Python is dynamically typed, but types exist. More importantly, Python is the poster child of duck typing. What is duck typing if not a way to implicitly specify protocols? If you're relying on protocols to work, why not have tests for it? If you want to test protocols, aren't you actually doing type checks?

If typing is a good thing,

...which undoubtedly is.

(...) why not make it an optional first-class part of the language?

It already is, isn't it?

But some people already have Python code that does not do type checking. What would be the point of refusing to run that code?

this post was submitted on 26 Jul 2023
12 points (100.0% liked)

Python

6224 readers
9 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS