this post was submitted on 20 May 2024
28 points (88.9% liked)

Python

6422 readers
40 users here now

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

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

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

founded 1 year ago
MODERATORS
 

Good evening, everyone. I have, but one quick inquiry. What are the best resources in your opinion to learn python by yourself as a complete beginner? Thank you all

you are viewing a single comment's thread
view the rest of the comments
[–] eager_eagle@lemmy.world 2 points 6 months ago (1 children)

I guess partly because the Python tooling catastrophe makes it a quite a pain to set them up.

Salty huh

Saying you need to set up type hinting in Python shows that you're the one assuming it's a hassle like TS, where you need a different runtime to have access to something the language (JS) should have provided from the start.

Everything you need is provided by typing, which is included in a Python install. Just import it and start using it.

[–] FizzyOrange@programming.dev 1 points 6 months ago (1 children)

Salty huh

Very. Python's shit tooling has cost me literal weeks of my life. It's so bad. Have you ever used Go or Rust? If not go and try them and then you will realise that it doesn't have to be like that.

Saying you need to set up type hinting in Python shows that you’re the one assuming it’s a hassle like TS

I'm not assuming. I have done this. It is absolutely a hassle. TS isn't exactly hassle free but it's still better than Python.

where you need a different runtime to have access to something the language (JS) should have provided from the start.

You mean like MyPy or Pyright? At least Typescript defines the semantics of its type hints. Python only defines the syntax! You can have multiple type checkers that conflict with each other!

Everything you need is provided by typing, which is included in a Python install. Just import it and start using it.

If you do that, nothing will actually be checked. You need to explicitly run pyright in CI.

[–] mapto@lemmy.world 1 points 6 months ago (1 children)

If you do that, nothing will actually be checked. You need to explicitly run pyright in CI.

Are you suggesting that you prefer to do the type validation upon execution? I'd like to have the checks done beforehand, be it in the IDE during coding or in CI. This way the feedback loop is shorter.

Then, backwards compatibility is a big thing in python, unlike node. So when typehints were introduced in 3.5 with PEP 484, they had to be optional.

At least Typescript defines the semantics of its type hints. Python only defines the syntax! You can have multiple type checkers that conflict with each other!

It is a bit more complicated than that. Here's a quote the above-mentioned PEP (3.5 was back in 2015, we're at 3.12 now and typehints have evolved):

Note that this PEP still explicitly does NOT prevent other uses of annotations, nor does it require (or forbid) any particular processing of annotations, even when they conform to this specification. It simply enables better coordination, as PEP 333 did for web frameworks.

https://peps.python.org/pep-0484/

[–] FizzyOrange@programming.dev 1 points 6 months ago

Are you suggesting that you prefer to do the type validation upon execution?

No. But I would like them to actually be done! If you just write some Python code and put type hints in it and don't do anything else then those types are not checked at all. It requires some set up and a third party tool to use them properly.

It is a bit more complicated than that. Here’s a quote

That quote is exactly what I was saying. It does not require any particular processing or type hints.

Type checkers can and do differ in whether they accept a particular piece of code.