MPCS 51052 Advanced Python Programming (Spring 2021)

Section 1
Instructor(s) Mesa, Lorena (lorenanicole)
Location Online Only
Meeting Times Monday 5:30pm - 7:30pm
Fulfills Elective



Python is a general-purpose programming language that is used in many application areas, including data science, machine learning/AI, web development, scientific computing, graphical user interfaces, systems programming, gaming, rapid prototyping, and more. This course provides a thorough overview of the Python 3 language with an emphasis on writing idiomatic code in Python and object-oriented design patterns and is suitable for students with some prior programming experience. We will develop an understanding of the core features of the languages and gain exposure to commonly used standard-library and third-party modules.

Course Format

Weekly classes will provide lectures, programming examples, in-class quizzes, and code review from previous assignments. In the first half of the quarter, four multi-part assignments will be given with one week for completion as well as a midterm examination. In the second half of the quarter, students will work on a project of their choosing and will present their work at the end of the class.

You are strongly encouraged to bring a laptop to class to follow along with examples interactively.

Week 1: Recap of basics of Python
Week 2: Metaprogramming
  • Callable classes
  • Decorators
  • Monkey patching  ** connected to unit testing
Week 3: Developer Tools & Testing
  • Linter
  • Debugger
  • Profiling and benchmarking code
  • PyTest
Week 4: Working with databases
  • NoSQL vs SQL options
  • Popular modules e.g. sqlalchemy
Week 5: Networking Programming
  • Socket, requests module
  • Connecting to client 
  • Client-server chatting program
Week 6: Multiprogramming
  • Threading
  • Sharing Variables
  • Multiprocessing
  • Pools
  • Async Programming  (e.g. co-routines)
  • Python’s GIL 
Week 7: Serializing Data
  • XML
  • JSON
  • YAML
  • Pickling
  • Protobufs
  • Dataclasses
  • Collections Module
Week 8: Python and the  Web 
  • Django
  • Flask
  • Web scraping with beautifulsoup and real time data scraping
Week 9: Python for Data Analysis 
  • SciPy & Pandas & Scikit-learn overview
    • Creating metrics for analysis 
    • Merge data frames from disparate data source
  • Analytics Vidhya dataset- Loan Prediction Problem
  • Building a predictive model with sklearn
Week 10: CPython Internals & Type Hinting


Example final project:

Build a web scraper that collects ingests data with a daily cron that generates a daily report on derived data
Must include:
  • Type hinting
  • Unit tests
  • Data schema of their own design
Introduce KPIs that their project will need to adhere to 


While there are no required textbooks for this course, the following books may be useful for reference:

Learning Python, by Mark Lutz
Think Python: How to Think Like a Computer Scientist, by Allen B. Downey
Fluent Python, by Luciano Ramalho
Python Cookbook: Recipes for Mastering Python 3
Python Essential Reference, by David Beazley

Course Prerequisites

B+ or higher in MPCS 51042 Python Programming

Other Prerequisites

Overlapping Classes

This class is scheduled at a time that conflicts with these other classes:

  • MPCS 58020-1 -- Time Series Analysis and Stochastic Processes
  • MPCS 51083-2 -- Cloud Computing