Giter Site home page Giter Site logo

python-mastery's Introduction

Advanced Python Mastery

A course by David Beazley (https://www.dabeaz.com)
Copyright (C) 2007-2023

Synopsis

An exercise-driven course on Advanced Python Programming that was battle-tested several hundred times on the corporate-training circuit for more than a decade. Written by David Beazley, author of the Python Cookbook, 3rd Edition (O'Reilly) and Python Distilled (Addison-Wesley). Released under a Creative Commons license. Free of ads, tracking, pop-ups, newsletters, and AI.

Target Audience

This course is for Python programmers who want to move beyond short scripts to writing more sophisticated programs. Topics focus on programming techniques that get used in popular libraries and frameworks. The primary goal is to better understand the Python language itself so that you can understand other people's code and so that you can apply your newfound knowledge to your own projects.

Prerequisites

You already know some Python. This is not a course for beginners. For more introductory material, you might consider the Practical Python Programming course.

How to Take the Course

To take the course, you should first fork/clone the GitHub repo to your own machine.

It is assumed that you are working locally in a proper Python development environment. That means a proper installation of Python, an editor/IDE, and whatever other tools that you would normally install to work on Python. Due to the use of multiple files and module imports, the use of Notebooks is not recommended.

The PythonMastery.pdf file contains detailed presentation slides. Course exercises and suggested timings are clearly indicated. You'll want to keep this by your side (I recommend downloading and viewing it with a local PDF viewer). Start here!

The Exercises/ directory has all of the course exercises.

The Solutions/ directory has fully worked out solution code.

The Data/ directory has some datafiles used during the course.

The course was originally taught over 4-5 days in an in-person classroom setting with a mix of lecture and hands-on exercises. Successful completion of the course will likely require 30-50 hours of work. Exercises tend to build upon each other. Solutions are always provided in case you get stuck.

Supplemental Material

The Advanced Python Mastery course often suggested more in-depth tutorials on selected topics. These were presented at the PyCon conference and might be of interest:

Questions and Answers

Q: Are any videos available?

A: No. You will be able to more quickly read the presentation slides which contain technical information. However, the Python Programming Language: LiveLessons video available on O'Reilly's Safari site is closely related to the material in this course.

Q: Can I use these materials in my own course?

A: Yes. I just kindly ask that you give proper attribution.

Q: Do you accept bug reports or pull requests?

A: If you've found a bug, please report it! However, I'm not looking to expand or reorganize the course content with new topics or exercises.

Q: Are the presentation slides available in any format other than PDF?

A: No.

Q: Is there any forum/chat where the course can be discussed?

A: You can use GitHub discussions to discuss the course.

Q: Why wasn't topic/tool/library X covered?

A: The course was designed to be completed in an intense 4-day in-person format. It simply isn't possible to cover absolutely everything. As such, the course is focused primarily on the core Python language, not third party libraries or tooling.

Q: Why aren't features like typing, async, or pattern matching covered?

A: Mainly, it's an issue of calendar timing and scope. Course material was primarily developed pre-pandemic and represents Python as it was at that time. Some topics (e.g., typing or async) are sufficiently complex that they would be better covered on their own in a separate course.

Q: Why did you release the course?

A: This course was extensively taught pre-pandemic. Post-pandemic, my teaching has shifted towards projects and CS fundamentals. However, why let a good course just languish on my computer?

Q: How can I help?

A: If you like the course, the best way to support it is to tell other people about it.


>>> Advanced Python Mastery
... A course by dabeaz
... Copyright 2007-2023

. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

python-mastery's People

Contributors

aymane11 avatar chaoyingz avatar dabeaz avatar darshandzend avatar davidlowryduda avatar eliahkagan avatar kozistr avatar l0b0 avatar matusf avatar pitmonticone avatar regisb avatar sulimansagindykov avatar williamrowell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-mastery's Issues

dicts are ordered

In PythonMastery.pdf page 2-6, the sentence An unordered set of values indexed by "keys" should be changed, because dictionaries are ordered since Python 3.6

JS

WHERE CAN I GET JAVASCRIPT LIKE THIS PLEASE?

Add answers to ex2_2

Even if you don't include an implementation, you should include the correct results for the exercise prompt.

How many bus routes exist in Chicago?

'Number of unique routes:'
181

How many people rode the number 22 bus on February 2, 2011? What about any route on any date of your choosing?

'Number of route 22 riders on 02/02/2011:'
[Row(route='22', date='02/02/2011', daytype='W', rides=5055)]

What is the total number of rides taken on each bus route?

'Most popular routes:'
[('79', 133796763), ('9', 117923787), ('49', 95915008)]

What five bus routes had the greatest ten-year increase in ridership from 2001 to 2011?

'Route with most increase in passengers between 2001 and 2011:'
[('15', 2732209),
('147', 2107910),
('66', 1612958),
('12', 1612067),
('14', 1351308)]

Cannot run solution for 1_3 pcost.py - FileNotFoundError

The relative path is written as ../../Data/portfolio.dat, but unfortunately this results in a FileNotFoundError: [Errno 2] No such file or directory: '../../Data/portfolio.dat'. In my solution I had to use the pathlib library to construct a path as such:

root_dir = Path(__file__).resolve().parent.parent.parent
relative_dir = 'Data/portfolio.dat'
filename = root_dir / relative_dir
f = open(filename, 'r')```

Missing information in exercise 2.5 (e) Challenge

Your challenge is to modify the RideData class, however to show the expected result you use readrides.read_rides_as_columns() as an example and this method does not currently return a RideData object...

Should this method also be modified to return a RideData object? Otherwise modifying RideData will have no affect on the output of readrides.read_rides_as_columns() ?

It's probably going to look a little crazy. Can you modify
the `RideData` class so that it produces a proper slice that
looks like a list of dictionaries? For example, like this:
```python
>>> rows = readrides.read_rides_as_columns('Data/ctabus.csv')
>>> rows
<readrides.RideData object at 0x10f5054a8>

Missing recommendation in Exercise 7.2

The Discussion at the end of Exercise 7.2 says the following:

Writing robust decorators is often a lot harder than it looks. Recommended reading:

However, there's no recommendation. Perhaps it was omitted accidentally?

ex2_5 collections.Sequence

Thanks for the helpful course.
Small issue I ran into in exercise 2_5 in:

import collections
class RideData(collections.Sequence):

Gave me an attribute error running python 3.11 on a windows machine.
This is due to:

`DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated 
since Python 3.3, and in 3.10 it will stop working` 

This issue provides more detail.
adding

'import collections.abc'  

and

'class RideData(collections.abc.Sequence)'

Solves this

add topics

I suggest adding the topics tutorial, python-tutorial in the About section. Thanks for your project.

slide 2-44: squares() is not called

Thank you very very much for this material. It's amazing! I'm super grateful for it.

I think I spotted a small error in the code on slide 2-44:

-for n in squares:
+for n in squares([1, 2, 3, 4, 5]):

I think the squares should be called to be effective.

Thank you again for sharing your knowledge.

typo in slide 2-71

After reassignment of a = [4, 5, 6], b still pointing to [1, 2, 3] should have a memory ref = 2 but slide says ref = 1.

Screen Shot 2023-08-15 at 2 17 06 PM

Slide 3-75 in pdf: Wording of handler usage

The handler is the same object isn't it?

Should the sentence:

Notice how various steps of the algorithm are deferred to a separate handler object

Be phrased:

Notice how various steps of the algorithm are deferred to a separate (method|function) of the handler object

Typo in slide 3-68 ?

In the example for context manager.

Shouldn't the following:

if type:
    print('An exception occurred')

be instead

if ty:
    print('An exception occurred')

Slide I.II: Block comments in Python

In slide I.II it is mentioned:

There are no block comments in Python (e.g., /* ... */).

While triple quotes are technically strings not comments, they could serve the same purpose as block comments? do you think this is worth mentioning?

Thank you

Exercise 5.4 Need help with eliminating names from typedproperty

In the last challenge of this exercise, we are asked to eliminate the need for providing names to typedproperty. I can't get this to work with the closure template provided. Can I get some more hints or just the solution, as I have been banging my head against this problem for a couple of hours now? I realize that __set_name__ is called under the hood when assigning properties to the class, and this was pretty clear in the valiidate.py exercise. I'm unsure how this works when extending the class with these typedproperty methods. Thanks for the help.

Slides comments

Hi David, first of all thanks for providing this course, it’s been great so far (currently chapter 6).

I just wanted to share some comments/questions that came up while looking at the slides:

  1. In the slide 3-77 there is an extra handler in formatter = TextTableFormatter(handler)

  2. The MRO of 4-21 doesn't match the hierarchy previously defined

    • If E was intended, I think it should be (__main__.E, __main__.C, __main__.A, __main__.D, __main__.B, object)
    • If D was indeed intended, I think it should be (__main__.D, __main__.B, object)
  3. In 5-14 the following is mentioned:

    Important: there are no type signatures or other details to help people reading your code. If you can help clarify, that's usually good.

    Type hints although not enforced by python exist so it can help (they’re even mentioned on the next slide), so imo the sentence may be confusing

WhatsApp

Welcome!

Use discussions to:

  • Ask questions about the course
  • Share ideas and interesting resources.
  • Engage with other members who are working on the course material.

I'm not always available to answer detailed course questions, but perhaps discussions can be used as an ongoing knowledge base for the course.

Cheers,
Dave

Originally posted by @dabeaz in #1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.