Live data from Hacker News

Ask HN: Coming back to Python after a 5 year hiatus–-what do I need to know?

news.ycombinator.com

11–17 of 17 posts

Re: Ask HN: Coming back to Python after a 5 year hiatus–-what do I need to know?

#11
post #5

Don’t worry python is not js, you’re good. See docker, fastapi but depends on what you want to do.

:-) Thanks for pointing out FastAPI!

You're right, far less churn than when I came back to js after leaving off at backbone/coffeescript/grunt...

Re: Ask HN: Coming back to Python after a 5 year hiatus–-what do I need to know?

#12
post #4

Disclaimer that basically everything below is a personal opinion: - MyPy is a great (fine, decent) library for typing, but even without it, the type hints in newer python versions and typing standard library are super powerful. Not “rust” levels of powerful but at least on par with typescript - Django is still excellent and now supports async views via asgi. Outside of async, django+DRF+djoser are an excellent choice…

Thanks for the heads up about graphQL—I think I'll avoid for now. It will be for a new project so not a big deal. I just had a quick look at PyTorch... you're totally right this is miles ahead of what I remember. I forgot to ask about package management. Do you use pip, conda, poetry?

Personally I love poetry, if for no reason other than making publishing a breeze. If I can’t use it for some reason, I like managing virtual envs with pyenv (not to be confused with pipenv. You’re better off for having missed the controversies around that)

Oh btw virtualenv is gone now; you make envs using python -m venv myEnvName

Re: Ask HN: Coming back to Python after a 5 year hiatus–-what do I need to know?

#13
post #7

Opinions: 1) mypy is the best type checker, you could look into pylance or pyre though 2) Django's ORM is kinda bad vs. sqlalchemy, but this isn't new. I'd consider any framework where you can use sqlalchemy (most everything) 3) No improvements to interpreter really. In python3 you now have to import reload though :( 4) Celery still exists, it's inside of Airflow. In general "scheduling asynchronous jobs" is a thing…

Thank you! re: sqlalchemy, are there more options for python micro web frameworks like Flask? I enjoyed flask + sqlalchemy in the past.

You will love fastapi. It also works with sqlalchemy.

Re: Ask HN: Coming back to Python after a 5 year hiatus–-what do I need to know?

#14
post #6
post #4

Disclaimer that basically everything below is a personal opinion: - MyPy is a great (fine, decent) library for typing, but even without it, the type hints in newer python versions and typing standard library are super powerful. Not “rust” levels of powerful but at least on par with typescript - Django is still excellent and now supports async views via asgi. Outside of async, django+DRF+djoser are an excellent choice…

> but at least on par with typescript I wish this were true, but mypy is far behind typescript. For example, mypy has `Literal["foo"]`, but typescript has the ability to template literals like `"foo-${bar}"` etc, and actually understand the results statically. That's not to say mypy isn't great, it has some really good stuff, but I mostly think you're underselling Typescript here.

Huh, good to know. Does this issue apply to f-strings or are you talking about format methods? I did a brief look through issues and MyPy seems to support f-strings fine, but I’d 100% believe that there are still kinks to work out

Re: Ask HN: Coming back to Python after a 5 year hiatus–-what do I need to know?

#15
post #12

Earlier quoted context omitted.

Thanks for the heads up about graphQL—I think I'll avoid for now. It will be for a new project so not a big deal. I just had a quick look at PyTorch... you're totally right this is miles ahead of what I remember. I forgot to ask about package management. Do you use pip, conda, poetry?

Personally I love poetry, if for no reason other than making publishing a breeze. If I can’t use it for some reason, I like managing virtual envs with pyenv (not to be confused with pipenv. You’re better off for having missed the controversies around that) Oh btw virtualenv is gone now; you make envs using python -m venv myEnvName

Nice, I’ll check out poetry.

That’s great that some of the virtualenv functionality made its way into the standard library!

Re: Ask HN: Coming back to Python after a 5 year hiatus–-what do I need to know?

#17
post #14
post #6

Earlier quoted context omitted.

> but at least on par with typescript I wish this were true, but mypy is far behind typescript. For example, mypy has `Literal["foo"]`, but typescript has the ability to template literals like `"foo-${bar}"` etc, and actually understand the results statically. That's not to say mypy isn't great, it has some really good stuff, but I mostly think you're underselling Typescript here.

Huh, good to know. Does this issue apply to f-strings or are you talking about format methods? I did a brief look through issues and MyPy seems to support f-strings fine, but I’d 100% believe that there are still kinks to work out

Ah, so mypy supports fstrings, but not in types. So you can do

    Direction = Literal["left", "right"]
But this won't work:

    eft = "eft"
    ight = "ight"
    Direction = Literal[f"l{eft}", f"r{ight}"]
(Yes, this is super contrived, I bad at coming up with examples, but https://mariusschulz.com/blog/string-literal-types-in-typesc... shows some realistic examples where it's useful in typescript)
Post reply on HN