Live data from Hacker News

Think Python, 3rd Edition

allendowney.github.io

111–120 of 126 posts

Re: Think Python, 3rd Edition

#111
post #67

Earlier quoted context omitted.

Just follow the tutorial (yes, really) https://docs.python.org/3/tutorial/index.html

It's what I started with, but honestly it's not great. It also heavily overemphasizes the interactive interpreter

REPL is kind of the point: did you try to type and run any of the examples in the tutorial? Just skimming it would be less useful (for the very basics).

If you already know everything in the tutorial, then try a project in Python that you did previously (familiar project, new language—Python).

Re: Think Python, 3rd Edition

#112
post #56
post #48

Earlier quoted context omitted.

If you are I/O bound then asyncio or good old fashioned gevent will do great. If you are CPU bound, then use multiprocessing. If you need to accept "jobs" from elsewhere, use RabbitMQ (with or without Celery). If you have mixed CPU/IO workload that fits the worker pattern, then you would do all 3. At the top level you have a RabbitMQ consumer, fetching jobs from a remote queue and then putting these into a multiproce…

So do you recommend a single Python process running asyncio or multiprocessing or both? Or do people normally split these things amongst several Python processes? My understanding is that multiprocessing creates multiple interpreters but that it still comes across some GIL issues if all under the same Python process. I am in general quite comfortable with the actor model, and I would ideally use Erlang/Elixir here, b…

Single process with async if I/O bound. Multiprocessing if CPU bound. Both if the workload is mixed.

Re: Think Python, 3rd Edition

#113
post #54

Earlier quoted context omitted.

Can you give an example of what you consider a good solution in a different language? That will help us see exactly what you're looking for and how/whether it might be achieved in Python.

Erlang and Elixir. :)

That was what I was worried you'd say. So it doesn't seem like your question is about Python at all, and all your criticism of Python seems entirely unjustified. What you're actually saying is

"I have to work in a language other than Erlang/Elixir and I don't like it"

But Erlang/Elixir are defined by the sort of concurrency model that you say you want, so as far as I can see your question would be just the same if you were asking about Java or Go.

If you have a question like "I can do this in Java or Go. How do I do it in Python?" Then people might be able to help. But please stop with the criticism of Python for not being Erlang/Elixir, since Java and Go also are not that.

Re: Think Python, 3rd Edition

#115

Love Think Python, I have recommended it to so many learners: it balances the various concerns of a new programmer book really well. Allen Downey has a bunch of other books with somewhat similar approaches too https://greenteapress.com/wp/ -- some I do think he might have gone too far in the low-rigor side, but all the ones I've reviewed have been pretty good. (I was sharing a table at a conference with Allen some ti…

My friend's son (college senior) might go to Olin, which I recommended - and I learned about it only due to Think Python.

Re: Think Python, 3rd Edition

#116
post #115

Love Think Python, I have recommended it to so many learners: it balances the various concerns of a new programmer book really well. Allen Downey has a bunch of other books with somewhat similar approaches too https://greenteapress.com/wp/ -- some I do think he might have gone too far in the low-rigor side, but all the ones I've reviewed have been pretty good. (I was sharing a table at a conference with Allen some ti…

My friend's son (college senior) might go to Olin, which I recommended - and I learned about it only due to Think Python .

I went to Olin and took a class from Allen Downey. Highly recommended

Re: Think Python, 3rd Edition

#117

Think Python 2e changed the trajectory of my life. I took a single Java class and hated it so much I gave up on programming. A few years later as a network engineer I had a problem that seemed like it could be scripted and ended up picking up Think Python and fell in love with the language and programming in general.

Just as an counterexample, I started with bash/Perl, moved to Python and really liked it and then started getting issues due to dynamic typing. Around that time, Java was chosen to be the main language for our team and once I saw the benefits of static typing, there was no looking back. Since then Python has come a long way with optional typing support and IDEs to help enforce it but by now I am forever biased in fav…

It's a lot easier to appreciate Java when it isn't your first language. I think it's really important for new programmers to have a streamlined experience to their first magical moment with programming, when they understand they can do cool stuff and succeed by being persistent. ("Streamlined" may be overstating it, there will be lots of friction along the way, but it should be caused by bugs they introduced themselves and overcome by debugging, not by tangential or environmental factors.)

There's a lot of context and drudgery involved in programming that can dissuade people before they get to that magical moment, and they can blame themselves and think they weren't smart enough because they don't understand that the deck was stacked against them. For instance with Python, broken virtual environments can be really dissuading for new programmers.

I think Java's opinionated and verbose nature can be cumbersome to beginners, who have never debugged a type confusion issue and so don't give a hoot about static typing. But I think after programming in Python for a while, they'll see why eg declaring what exceptions you'll raise is tremendously helpful.

Re: Think Python, 3rd Edition

#118
post #115

Love Think Python, I have recommended it to so many learners: it balances the various concerns of a new programmer book really well. Allen Downey has a bunch of other books with somewhat similar approaches too https://greenteapress.com/wp/ -- some I do think he might have gone too far in the low-rigor side, but all the ones I've reviewed have been pretty good. (I was sharing a table at a conference with Allen some ti…

My friend's son (college senior) might go to Olin, which I recommended - and I learned about it only due to Think Python .

I meant "high-school senior." Argghh!

Re: Think Python, 3rd Edition

#119
Many thanks for this book! Think Python 2nd is the first book I've ever read in order to teach myself programming.

Now I've come a long way to become an actual developer shipping real products and have certainly learned a whole lot more on the topic, but I still think the first steps are the most important/difficult ones. Although I've moved away from Python towards other platforms such as Rust, the basic concepts covered in this book are still very much relevant.

I'm really excited to learn that Think Python has become more modern and interactive with this update!

Re: Think Python, 3rd Edition

#120

Think Python 2e changed the trajectory of my life. I took a single Java class and hated it so much I gave up on programming. A few years later as a network engineer I had a problem that seemed like it could be scripted and ended up picking up Think Python and fell in love with the language and programming in general.

This is just the sort of thing I needed to read. I am considering changing the trajectory of my own life, towards a more community/maker/teacher role, and I have a freelance/small business idea about teaching but I need sort of "soft syllabus" materials. I am learning Python myself, having just never had a need for it in all of my professional web development life (I've written apps in just about every other web-focu…

I would like to hear more about your trajectory. I'm in a similar place.
Post reply on HN