Live data from Hacker News

Think Python, 3rd Edition

allendowney.github.io

121–126 of 126 posts

Re: Think Python, 3rd Edition

#121
post #120

Earlier quoted context omitted.

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.

It's a sketch of a thought at the moment.

But I am, well, mid-life at best, and the only crisis I am experiencing is that I think much of what I have done for years is worth less than I would have hoped.

I think it is ironic that technology seems to serve people less and less (and advertisers more and more) at just exactly the same time as every possible piece of technology is falling in price and increasing in availability.

Want to make a small device with a colour LCD display, buttons, an entirely custom enclosure, a rechargeable battery and a custom PCB? The cost of doing that has never been lower. Even if you only want one.

Want to give some tool a comfortable handgrip for accessibility reasons that needs to be parametrically adjustable? The software tools are free and the prototyping tools are incredibly cheap.

Want to find the answer to a question about your local area that would have required months of library time? The software is free and shockingly complete data sets are available from governments.

So why do so many people, even adults my age and younger, feel that technology is out of their control?

I have always felt as a freelance developer that the work I am paid for is just the seed in the middle of a larger fruit, where I listen and discuss and explain and educate.

I feel I should be turning it inside out. Making the listening, discussion, education the product, and the development work ancilliary to it (because it almost always is).

What I find interesting about Python, specifically, is how many applications it is suitable for, considering its ease of access -- CAD packages, 3D printing, PCB design, GIS, microcontrollers, statistics. Children's and adult education etc.

So while I have a little time I am spending it re-orienting myself into Python as a programmer "way-of-life", and away from the tools I have been using so far (which has never, really, meant Python).

And as I do so I am getting a sense of how it might fit into me turning my freelance work inside out to become a teacher/trainer/educator/facilitator, largely for adults, to help them have better concepts of technology (even for just the humdrum business of getting suppliers to quote for bespoke projects).

A vague sketch, sorry -- but I think this might answer your question.

Re: Think Python, 3rd Edition

#122
since the new edition will use jupyter to run all the code, i wonder if would also address how to debug efficiently in jupyter.

in the meanwhile, how has your personal experience been around this? what worked for you, especially when you use a third-party notebook solution where you may not be able to install jupyterlab extensions?

Re: Think Python, 3rd Edition

#123
post #108

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/

What do you mean that TPe3 is "dumbed down"? I didn't notice anything appreciably reduced in the content yet but then again I haven't gone through and compared both editions, so I was interested in your comment.

Okay, apparently he re-wrote some of the problems and did some prose edits. I'm still not sure why that makes the new edition "dumbed down."

Re: Think Python, 3rd Edition

#124
post #46
post #35

How does one do proper concurrency in Python? As in separate "processes" running with encapsulation, fault tolerance, etc. For example, how does one bundle up a TCP client in a "process" such that the process handles failed connections, broken connections, retrieving data at periodic intervals (relatively fast), receiving "messages" from other "processes", etc.? There's Ray, Pyro, Pykka, Celery, multiprocessing, asyn…

Use asyncio. Bind to a socket, set blocking False, then asyncio.run(on_new_connection(sock)). Inside that coroutine get the loop and await loop.sock_accept(sock) And then asyncio.create_task(on_connection_data(connection)). The only gotcha is you need to keep a reference to that task so it doesn't get garbage collected.

Thank you. Do you have more information regarding this? Why do I await the socket acceptance? How do I handle the disconnect? How do I send messages into and out of the coroutine?

Re: Think Python, 3rd Edition

#125
post #107

Apologies for changing the subject, but aside from real world experience (which I have and am getting at work), is there a resource of similar quality for more intermediate/advanced Python programmers? I always feel like there's a big chunk of the language or stdlib I do not know.

+1 for Fluent Python. See also: * Serious Python ( https://nostarch.com/seriouspython ) — deployment, scalability, testing, and more * Practices of the Python Pro ( https://www.manning.com/books/practices-of-the-python-pro ) — learn to design professional-level, clean, easily maintainable software at scale, includes examples for software development best practices * Intuitive Python ( https://pragprog.com/titles/dmpy…

Author of Practices of the Python Pro here—thank you for recommending my book! I'd also recommend any of David Beazley's books.

Re: Think Python, 3rd Edition

#126
post #54

Earlier quoted context omitted.

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 yo…

Do you have any particularly helpful advice?

This is honestly pretty frustrating trying to build a system like this in Python. If you think asyncio, coroutines, tasks, multiprocessing, threads, subprocesses, etc. are simple and understandable in Python, then I would love for someone to explain them to me in a way that is manageable.

And no, the question would not be the same. Java and Go have proper concurrency substrates. Python does not.

Post reply on HN