26 ms·
Advanced Python Mastery
- simonw 3y agoWow. A now-CC-licensed 4 day (when presented in-person) Python training course that's been iterated on for 16 years! David wrote https://www.dabeaz.com/generators/ https://www.dabeaz.com/generators/ which remains one of my all-time favourite Python tutorials. Looking forward to digging into this.
- sebk 3y agoBeazley's Concurrency From the Ground Up is one of my favorite tech talks ever: In about 45 minutes he builds an async framework using generators, while live coding in an emacs screen that shows only about 20 lines and without syntax highlighting, and not breaking stride with his commentary and engaging with the audience. It's 8 years old, but definitely worth a watch: https://www.youtube.com/watch?v=MCs5OvhV9S4 https://www.youtube.com/watch?v=MCs5OvhV9S4
- philipov 3y agoIs that the one where he modified his interpreter to provide slapstick comedy as part of the talk?
- boredemployee 3y agoExactly what I thought while watching that video, it's as if he's spitting out the characters as he speaks.: "A fantastic, entertaining and highly educational talk. It always bothers me that I can't play the piano and talk at the same time (my wife usually asks me things while I'm playing). But David can even type concurrent Python code in Emacs in Allegro vivace speed and talk about it at the same time. An expert in concurrency in every sense of the word. How enviable!"
- drexlspivey 3y agoYes! My favorite Python talk, dude is a wizard
- samstave 3y agoWow - that was awesome - wish I had known of this vid for years - but thank you.
- throwaway290 3y agoI wish they turned off ads on this. If this is PyCon surely they get PSF sponsorship money anyway...
- rmbyrro 3y agoYou can pay YouTube to remove ads and help support content creators as well.
- throwaway290 3y agoWhy? I don't watch YouTube. Moreover, this video is from PyCon. Which is sponsored by PSF. Which is sponsored by google, meta, AWS etc. So who is pocketing the ad money? Why do I want to pay to support that person? As well as Google and its advertisers? The logic in your comment is incoherent.
- globular-toast 3y agoThere's also the one where he live codes a Webassembly interpretor. But my favourite is his talk on lambda calculus. It's incredibly fun to follow through.
- _ank_it 3y agothe love of programming and engineering .. this is what motivated me at first place to do CS
- heap_perms 3y agoYes, that talk is legendary. Very impressive how he is able to both talk and write the code at the same time.
- terlfgy 3y agoIt is entertaining and intelligent, but you won't learn Python from it and you won't get anywhere near a production ready implementation, since it glosses over all the hard parts.
- manvillej 3y agoIf we're talking favorite python tutorials, I am a huge fan of this tutorial on python entrypoints: https://amir.rachum.com/python-entry-points/ https://amir.rachum.com/python-entry-points/
- faizshah 3y agoSince we are sharing resources Fluent Python is my favorite reference on Python. It covers so many advanced features like concurrency, functools etc. It’s not the kind of book you read cover to cover it’s one that you go to as you need it, when I was working on python stuff I would read it once a month. My favorite introductory book (not an introduction to programming but an introduction to the language) is “Introducing Python by Lubanovic” because it’s one of the only beginner books that actually covers the python module system with enough depth and the second half of the book gives a quick overview of a lot of different python libraries.
- jeffrallen 3y agoPython is a tool for people from diverse backgrounds to work together with code. "Advanced mastery" works against this goal by elevating your level beyond what others can read and understand. But then again, I don't use list comprehensions, because I don't comprehend them, so what do I know.
- hiatus 3y ago> Python is a tool for people from diverse backgrounds to work together with code. Where did you get that idea? Python is a programming language. That some find it more accessible than others is orthogonal to the work needed to master it.
- ori_prior 3y agoAh, the lowest-common-denominator argument for why your code is crap. That is the reason that Python code has become what PHP was 10 years ago: The mark of projects to avoid at all cost.
- imissmymind 3y agoThat's not nice. Everyone is on their own journey, their own learning curve, to a level experience needed to fulfill their own ambition. Rather than saying, "your code is crap" wouldn't it be more productive to encourage this person to challenge themselves to get outside their comfort zone?
- wiseowise 3y ago> Everyone is on their own journey Not everyone is trying to be nice either.
- ori_prior 3y agoThat person explicitly dismissed "advanced mastery" and thus challenging and bettering oneself or themselves as being non-inclusive. I find this attitude highly offensive, because my motivation towards mastery is not of that kind. I'm happy to include people, explain them my code, help them along towards mastery. Software also has an ongoing quality crisis, all while being more and more influential in people's lives. That person's attitude towards writing quality software helps to deepen that crisis and is therefore harmful.
- twyclpc 3y agoBeazley is one of the good ones, but no other language has this level of marketing. Python is the Coca Cola of languages.
- yellowstuff 3y agoJava marketing in the 90s was more intense and much less organic, since it was totally driven by Sun.
- jononomo 3y agoI completely agree with this -- no programming language has ever had as much marketing behind it as Java. It was absolutely overwhelming for about 6-8 years from maybe 1997 - 2005. And what a disaster that has been -- a bunch of people now consider object-oriented programming to be a sensible approach.
- vithlani 3y ago[dead]
- postexitus 3y ago[flagged]
- musingsole 3y agoJava by Sun back in the day is much more the Coca Cola of languages. Today, maybe C# by Microsoft. Python's organic growth and adoption is more of an OpenCola model.
- cardosof 3y agoBeazley is one of the masters and his other books are great. My nitpick here is that, as in any other language, the basics are there forever and the advanced features/techniques get old and replaced every now and then.
- greatpostman 3y agoDavid beazley, also known as the Jimi Hendrix of python
- bshipp 3y agoI saw his talk live in 2014 and the dude is amazing. I loved his summary of building Python libraries from the ground up during legal discovery because he discovered a hidden Python installation on the terminal his opponents gave him that allowed him to parse thousands of documents very quickly. https://youtube.com/watch?v=RZ4Sn-Y7AP8 https://youtube.com/watch?v=RZ4Sn-Y7AP8
- jjice 3y agoBeazley is a mad man, so much fantastic stuff from him. My favorite is probably Ply and Sly as CFG parsers. I didn't even think to check for books he wrote but now I have to go down the rabbit hole.
- Al0neStar 3y agoI'm guessing this was submitted after the "Ask HN" about leveling up to a production python programmer and i'm surprised no one mentioned these books: 1. Test-Driven Development with Python 2. Architecture Patterns with Python The 2nd one is the closest you're gonna get to a production-grade tutorial book. Related to this topic, these resources by @dbeazley: Barely an Interface https://github.com/dabeaz/blog/blob/main/2021/barely-interface.md https://github.com/dabeaz/blog/blob/main/2021/barely-interfa... Now You Have Three Problems https://github.com/dabeaz/blog/blob/main/2023/three-problems.md https://github.com/dabeaz/blog/blob/main/2023/three-problems... A Different Refactoring https://github.com/dabeaz/blog/blob/main/2023/different-refactoring.md https://github.com/dabeaz/blog/blob/main/2023/different-refa... His youtube channel: https://youtube.com/@dabeazllc https://youtube.com/@dabeazllc
- synergy20 3y ago'written by the same author' -- thought it's dbeazley, it's somebody else in fact.
- Al0neStar 3y agoFixed it, i meant that both of the books mentioned are written by Harry Percival (and the 2nd was written as a sequel) .
- mafuku 3y agodamn, I feel really dumb trying to follow the logic of all those function compositions in the three problems post
- ddejohn 3y agoYou shouldn't. Author seems pretty tongue-in-cheek about it: > lambda has the benefit of making the code compact and foreboding. Plus, it prevents people from trying to add meaningful names, documentation or type-hints to the thing that is about to unfold. Disclaimer, I did not read the entire post.
- george_____t 3y ago
- deleted 3y ago[deleted]
- mark_l_watson 3y agoThis is very cool, good for Beazley for making this freely available. I really should take the time to work through this material. For 40 years I have been a “Lisp guy”, slightly looking down on other languages I sometimes used at work like C++, Java, etc. However, because of available ML/DL/LLM frameworks and libraries in Python, Python has been my go to language for years now. BTW, I love the other comment here that Beazley is the Jimi Hendrix of Python. Only those of us who enjoyed hearing Hendrix live really can get this.
- heap_perms 3y agoYou've listened to Hendrix live? Well now I'm envious ;)
- mark_l_watson 3y agoWell, it was just the one time.
- TheAlchemist 3y agoThis is very good. David is also doing online immersive courses - 1 week long but I believe he also splits them into one day sessions now. Highly recommended ! He has a real talent for explaining complicated concepts in a very simple and approachable way.
- jamesdutc 3y agoI taught this course to corporate clients for three or four years before developing my own materials. The course materials for this course and the introductory course (“Practical Python”[1]) are quite thorough, but I've always found the portfolio analysis example very hokey. There's enormous, accessible depth to these kinds of P&L reporting examples, but the course evolves this example in a much less interesting direction. Additionally, while the conceptual and theoretical materials is solid, the analytical and technical approach that the portfolio example takes quickly diverges from how we would actually solve a problem like this. (These days, attendees are very likely to have already been exposed to tools like pandas!) This requires additional instructor guidance to bridge the gap, to reconcile the pure Python and “PyData” approaches. (Of course, no other Python materials or Python instruction properly address and reconcile these two universes, and most Python materials that cover the “PyData” universe—especially those about pandas—are rife with foundational conceptual errors.) Overall, David is an exceptional instructor, and his explanations and his written materials are top notch. He is one of the most thoughtful, most intelligent, and most engaging instructors I have ever worked with. I understand from David that he rarely teaches this course or Practical Python to corporate audience, instead preferring to teach courses direct to the public. (In fact, I took over a few of his active corporate clients when he transitioned away from this work, which is what led me to drafting my own curricula.) I'm not sure if he still teaches this course at all anymore. However, I would strongly encourage folks to look into his new courses, which cover a much broader set of topics (and are not Python-specific)! [2] Also, if you do happen to be a Python programmer, be sure to check out his most recent book,“Python Distilled”[3]! [1] https://dabeaz-course.github.io/practical-python/ https://dabeaz-course.github.io/practical-python/ [2] https://www.dabeaz.com/courses.html https://www.dabeaz.com/courses.html [3] https://www.amazon.com/Python-Essential-Reference-Developers-Library/dp/0134173279 https://www.amazon.com/Python-Essential-Reference-Developers...
- diimdeep 3y ago> https://www.dabeaz.com/courses.html https://www.dabeaz.com/courses.html Well, unfortunately 5-day courses listed there are $1500 each. If the free of charge course discussed here is really that good, it is a nice promo to go and pay for another. Ed Tech Lo-Fi style.
- begoon 3y agoThe legend :-)
- begoon 3y agoAlso, the python content of Fred Baptiste, 4 parts course on Udemy, is the gold mine. As deep and detailed as I never imagined :-)
- heywhatupboys 3y ago> # pcost.py > total_cost = 0.0 > with open('../../Data/portfolio.dat', 'r') as f: > for line in f: > fields = line.split() > nshares = int(fields[1]) > price = float(fields[2]) > total_cost = total_cost + nshares * price > print(total_cost) yikes what a terrible reference implementation! Least they could do is reduce([...], +) as a two-liner
- w0m 3y agohttps://www.artima.com/weblogs/viewpost.jsp?thread=98196 https://www.artima.com/weblogs/viewpost.jsp?thread=98196 map/reduce (for better or worse) get a bad rap. Some blog or training I took when first starting up with the language told me 'map/reduce Bad' and I have generally avoided ever since.
- kingkongjaffa 3y agoSomething I hate in my own code is this pattern of instantiating an empty list and then iterating on it when reading files. Is there a better way than starting lst= [] and then later doing lst.append() This is an example from the linked course https://github.com/dabeaz-course/python-mastery/blob/main/Exercises/ex2_2.md https://github.com/dabeaz-course/python-mastery/blob/main/Ex...: ``` # readport.py import csv # A function that reads a file into a list of dicts def read_portfolio(filename): portfolio = [] with open(filename) as f: rows = csv.reader(f) headers = next(rows) for row in rows: record = { 'name' : row[0], 'shares' : int(row[1]), 'price' : float(row[2]) } portfolio.append(record) return portfolio ```
- BeetleB 3y agoYou could try to squeeze it all into a list comprehension.
- thrdbndndn 3y agoThere is always list comprehension. So `portfolio = [{'name': row[0], 'shares': int(row[1]), 'price': float(row[2]) for row in rows]` But if it's more complicated than this (like if there is conditional(s) inside the loop), I'd recommend just stick with the current approach. It's possible to have even multiple conditionals in list comprehension, but it's not really very readable. If you do want to, walrus operator can make things better (something like `numbers = [m[1] for s in array if (m := re.search(r'^.*(\d+).*$', s))]`)
- roywiggins 3y agoYou can alternately stick the logic into a function, which maintains the readability. def get_record(row): return { 'name': row[0], 'shares': int(row[1]), 'price': float(row[2]) } return [ get_record(r) for r in rows ] or return list(map(get_record, rows))
- 3y ago
- zzbn00 3y agoThe author is of this course is also one one of the original authors of SWIG which got discussed here just yesterday. Two HN front pages in two days! https://news.ycombinator.com/item?id=36769912 https://news.ycombinator.com/item?id=36769912 https://www.swig.org/guilty.html https://www.swig.org/guilty.html
- sitkack 3y agoPeople should not take that an endorsement of Swig. Please use ctypes, cffi or https://github.com/wjakob/nanobind https://github.com/wjakob/nanobind Beazley himself is amazed that it (Swig) is still in use.
- throwawaymobule 3y agoIt's probably not the case this time, but a lot of the time someone will browse around after clicking on a link here and find another interesting thing worth posting. Love that about hn.
- sirodoht 3y agoI've attended two week-long courses of the author, David Beazley, and they were both amazing. Highly recommended.
- chrsw 3y agoIs there a C version of something like this?
- Santosh83 3y agoC Unleashed by Heathfield etc and Modern C by Jens Gustedt are two am aware of. Oh and also Expert C Programming by Peter van der Linden
- deleted 3y ago[deleted]
- crabbone 3y ago[flagged]
- michaelhoffman 3y ago> A Python program may contain statements or expressions. Here's a Python program that contains no statements: 42. According to the Python Language Reference, that is a Python program made of one expression statement: https://docs.python.org/3/reference/simple_stmts.html#expression-statements https://docs.python.org/3/reference/simple_stmts.html#expres...
- crabbone 3y agoPython documentation is written by morons who don't understand well the subject they are discussing. Yes, it may be surprising, but it's very possible and happens all the time that a person can do something proficiently, but not know what or how they are doing. Python documentation is full of nonsense, contradictions, bad definitions etc. There's no such thing as "expression statement", it doesn't matter that they say so or write it in documentation. It's like saying "fraction integer" -- it has to be one or the other.
- michaelhoffman 3y agoThey're in good company—the C standard also has something called an "expression statement" which is similar.
- throw1234651234 3y agoWell, you know what they say about polishing certain things. Python is just not meant to write serious applications, despite all the startups using it. Let's stick to OpenCV and ML applications, NOT line-of-business. Doesn't even have static typing, might as well use JavaScript.
- jamesdutc 3y agoI agree that the average quality of Python instructional material is quite low. The language is very popular, and it's often pitched as a beginner's language or a language for those who are not (or do not want to be) professional programmers. Free (uncurated) platforms like YouTube and LinkedIn make it very easy to distribute poor quality material (and provide very weak feedback to encourage quality improvement.) I strongly reject any assertion that David Beazley's materials, his instructional abilities, or his capabilities as a programmer are lacking. Having worked with David, I can provide testimonial to his skills (though his body of work speaks for itself.) The example you highlight amounts to little more than nitpicking, and it suggests a fundamental misunderstanding of the instructional process. Trust me: I have taught this exact course (as well as “Practical Python”) to numerous corporate audiences.
- underdeserver 3y agoDavid Beazley will forever have my respect for his talk where he uses Python to untangle 1.5T of C++ code on an airgapped computer, as an expert witness in a court case: https://youtu.be/RZ4Sn-Y7AP8 https://youtu.be/RZ4Sn-Y7AP8 It's 47 minutes and totally worth it.
- faitswulff 3y agoI don't even write Python but after watching Beazley's concurrency talk I will watch David Beazley talks all day. Adding this to the list
- stuckinhell 3y agoJust skimming through it, and wow I'm impressed! I wish people had something like this for other languages!
- hospitalJail 3y ago>generators Oh man, that is some job security! Generators seem unpythonic.
- charlysl 3y agoAnother good (and entertaining) resource is James Powell's talk "So you want to be a Python expert" [1], the best explanation I've seen of decorators, generators and context managers. Good intro to the Python data (object) model too. [1] https://youtu.be/cKPlPJyQrt4 https://youtu.be/cKPlPJyQrt4
- fuzztester 3y agoIt was for Python 2, and the book was published many years ago, but Beazley's Python Library Reference book (if I remember the name correctly) was one of the best software reference books that I bought and read. I googled, and this seems to be the current edition: https://www.amazon.in/Python-Essential-Reference-Essentia-Developers-ebook/dp/B002EF2AQ6 https://www.amazon.in/Python-Essential-Reference-Essentia-De...
- agumonkey 3y agoI appreciated greatly every talk dave made I saw. Am naturally quite thrilled to see what's he got for us here. Thanks.
- albert_e 3y agoThank you. Timely as my team is looking to skill up on advanced python.
- vladukha 3y agoIs there something similar for Java/Kotlin?
- fzzzy 3y agodabeaz signed my copy of python essential reference for 1.5.2