4 ms·
Personal stylistic opinion here but while the concept of annoations is pythonic, I think the implementation we got is the opposite. It uses magic glyphs that re
by zanny 13y ago
Personal stylistic opinion here but while the concept of annoations is pythonic, I think the implementation we got is the opposite. It uses magic glyphs that require research to interpret - especially if you come from any other programming language, because when you see things like a : b, or foo -> bar, you expect that to have some syntactic meaning.
The fact that the colon and right arrow in a Python annotation are, for the interpreter, a no-op, is insanely confusing to a newbie or just a generalist. It is compounded by how it would have made much more sense to reserve keywords in their places, so instead of
def foo( a : "fruit", b : Color) -> Pineapple:
you could have used reserved names:
def foo( a expects "fruit", b expects Color) returns Pineapple:
Which is a lot more readable in the way Python is meant to be. Good Python code reads more like prose than software, and the former prevents that from happening at all.
- Mizza 13y agoI agree completely! When I see a ':', I think slice syntax, and when I see a '->', I think.. hashrocket? What is this madness? Is anybody interested in working on a PEP about this?
- ak217 13y agoI agree with you. I think it was a mistake to use punctuation, and I like the keywords that you propose.