Live data from Hacker News

Think Python, 3rd Edition

allendowney.github.io

91–100 of 126 posts

Re: Think Python, 3rd Edition

#91

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…

Python is challenging as a production language, given its tooling inconsistencies, but it’s a great pseudocode language.

Re: Think Python, 3rd Edition

#92
post #86

Earlier quoted context omitted.

Rather than handling the multiprocessing and message passing yourself it would be much easier to use celery + gevent and let celery do the work of spinning up processes for executing the tasks. It may feel limiting but my advice would be to keep all the celery job queue stuff isolated from your server, especially if you are using an async web framework. Have your web server just put all the jobs in the celery queue a…

Can Celery help handle state internal to the workers? What about using Pkykka alongside Pyro such that each Pyro remote object is actually a Pykka actor? Such that Pyro allows splitting workers across separate Python OS processes and the "messaging" while Pykka handles the internal state.

Could you give an example of state internal to the worker?

Re: Think Python, 3rd Edition

#93

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.

Think Python helped me finally understand OOP for the first time, after a C++ class, a Java class, etc.

Re: Think Python, 3rd Edition

#94
post #22

Earlier quoted context omitted.

Similar for me - I had learned some Java, Matlab, C, Perl here and there but it wasn’t until Think Python 2e that I was gripped and from there read many other books and changed my career to software.

What other books did you read that you would recommend?

I enjoyed “Data Structures and Algorithms in Python”!

Re: Think Python, 3rd Edition

#95
post #24

Earlier quoted context omitted.

Similar for me - I had learned some Java, Matlab, C, Perl here and there but it wasn’t until Think Python 2e that I was gripped and from there read many other books and changed my career to software.

Couldn't this result be more attributable to Python itself than the book?

Maybe, but I think the book really was different from any book I had read before. Most books teach the language, but Think Python showed me some of the why, what each data structure might be used for, it would quickly dip into some interesting implementation details to give me a more solid foundation and then zoom out and give me perspective on why something is useful and related software writing skills and tips. It was thorough, but also concise, and the exercises were engaging, so I found myself for the first time really getting sucked into the zone with the problems and time was flying by. This hadn’t happened to me with Java or Perl.

Re: Think Python, 3rd Edition

#96
post #86

Earlier quoted context omitted.

Can Celery help handle state internal to the workers? What about using Pkykka alongside Pyro such that each Pyro remote object is actually a Pykka actor? Such that Pyro allows splitting workers across separate Python OS processes and the "messaging" while Pykka handles the internal state.

Could you give an example of state internal to the worker?

Similar to how one can pass around state inside an OTP GenServer in Erlang.

In Python, it could be a class managing a session type of object, like a TCP socket connection, or managing some piece of hardware that is doing something independently of the other parts of the system, or a database writer, etc.

Re: Think Python, 3rd Edition

#97
post #87

I love these books … in my case Think Perl6 (now Think Raku) was a real eye opener. A quick scan of the new Python 3rd edition looks like it is quite dumbed down - which is probably appropriate for Python. I highly recommend the intro to Functional Programming in Raku (chapter 14). https://greenteapress.com/wp/think-perl-6/

Cool, I didn't know about this book! I enjoyed Think Python, but this book surprises me. I'd think there are very few people learning Perl / Raku as their first language nowadays, so a book targeting more experienced programmers seems like it would make a lot more sense.

At one point I started writing a book about Raku for Perl programmers.

For various reasons, I did not finish that: but what did got written, wound up as a 24-part blog series on dev.to: https://dev.to/lizmat/series/24075

Re: Think Python, 3rd Edition

#98
post #6

Tangential, is there a book to learn typing? I feel I need a hefty book to learn typing. Don't mind if you recommend a Typescript book or other language with similar concepts.

This is an odd question to read. The first programming language I learned* was C and types were so fundamental that you HAD to learn them if you were going to do anything at all.

So now I wonder, do people really spend so much time in weakly typed languages that types seems to be a special concept? Or is there something about types that has gotten so complex that its worthy of extra study?

*I did do some BASIC as a middle schooler but it didn't stick. C did.

Re: Think Python, 3rd Edition

#99
post #24

Earlier quoted context omitted.

Similar for me - I had learned some Java, Matlab, C, Perl here and there but it wasn’t until Think Python 2e that I was gripped and from there read many other books and changed my career to software.

Couldn't this result be more attributable to Python itself than the book?

Think Python and the other books in the Think X series are more about how to think like a programmer in X.

It's not just a book about a language, but an introduction into the basics of solving problems as a programmer.

Re: Think Python, 3rd Edition

#100
post #96

Earlier quoted context omitted.

Could you give an example of state internal to the worker?

Similar to how one can pass around state inside an OTP GenServer in Erlang. In Python, it could be a class managing a session type of object, like a TCP socket connection, or managing some piece of hardware that is doing something independently of the other parts of the system, or a database writer, etc.

Oh sure, if I'm understanding you correctly. It's been a few years since I've wrenched on such code, but IIRC, you can pass any seralizable object you want to the function being executed. We used to pass around an in-memory class object, no problem. The tricky part was control flow, but that wasn't celery's problem.
Post reply on HN