• Stars
    star
    727
  • Rank 61,883 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Write Pythonic Code Like a Seasoned Developer video course demo materials.

Write Pythonic Code Like a Seasoned Developer Course Demo Code

Pythonic Code Course Welcome Video

[Jump to source code: write-pythonic-code-demos/tree/master/code]

One of the special concepts in Python is the idea of writing idiomatic code that is most aligned with the language features and ideals. In Python, we call this idiomatic code Pythonic. While this idea is easy to understand, it turns out to be fairly hard to make concrete.

This course will take you on a tour of over 50 of the more popular and useful code examples demonstrating examples of Pythonic code. In the examples, you'll first see non-Pythonic code and then the more natural Pythonic version.

Topics covered include the expansive use of dictionaries, hacking Python's memory usage via slots, using generators, comprehensions, and generator expressions, creating subsets of collections via slices (all the way to the database) and more. Several of these are Python 3 features so you'll have even more reason to adopt Python 3 for your next project.

What topics will we cover?

This course covers over 50 concrete programming tips to write more Pythonic code. These tips are grouped into the following broad categories.

  • Pythonic Foundational Concepts
  • Dictionaries
  • Generators and Collections
  • Methods and Functions
  • Modules and Packages
  • Classes and Objects
  • Loops
  • Tuples
  • Python for Humans

See the full course table of contents below.

Join the course

https://talkpython.fm/pythonic

What is Pythonic code and why does it matter?

One of the special concepts in Python is the idea of writing idiomatic code that is most aligned with the language features and ideals. In Python, we call this idiomatic code Pythonic. When you write Pythonic code, you are leveraging over 25 years of experience of many thousands of developers. You are writing code that is expected and tune in the CPython runtime. Most importantly perhaps, you are writing code that is easily read and understood by your fellow and senior Python developers.

If you are building an open source product, it will be easier for other contributors to join in if your code is Pythonic. If you are running a software team, it will be easier to onboard Python developers new to your company.

On the flip side, if you are somewhat new to Python, you may be broadcasting this loud and clear to everyone listening: your teammates, interviewers if you're looking for a new job, audience members if you're giving a public presentation. This is less than ideal.

Finally, many of the over 50 tips covered in this course that are considered "Pythonic" allow you to write more readable code, more maintainable code, and more efficient code. So in some sense, you can think of this course as an effective Python course in its own right.

Who is this course for?

The course is for beginner to intermediate Python developers looking to hone their Python programming skills and become true professionals in the Python space. It is not a "Learn Python from Scratch" course and assumes you are familiar with language constructs such as modules, functions, classes, and more.

If you are looking to learn Python from scratch, please consider my Python Jumpstart by Building 10 Apps course.

This course will cover Python 3

The course will cover Python 3 (3.5 specifically), but 96% of what you learn will be translatable back to Python 2 with virtually no effort. The few features that are Python 3 specific will be highlighted as such (e.g. new dictionary merging syntax).

Python 2 will literally become unsupported in less than 4 years (in 2020). That's coming up faster than people realize and focusing on Python 3 going forward is important.

More Repositories

1

python-jumpstart-course-demos

Contains all the "handout" materials for my Python Jumpstart by Building 10 Apps course. This includes try it yourself and finished versions of the 10 apps.
Python
746
star
2

mongodb-quickstart-course

Course demos and handout material for Talk Python's MongoDB Quickstart course
Python
306
star
3

python-for-entrepreneurs-course-demos

Contains all the "handout" materials for Talk Python's Python for Entrepreneurs course. This includes notes and the final version of the website code.
Python
285
star
4

python-switch

Adds switch blocks to Python #pypackage
Python
247
star
5

jinja_partials

Simple reuse of partial HTML page templates in the Jinja template language for Python web frameworks. #pypackage
Python
191
star
6

mongodb-for-python-developers

MongoDB for Python developers course handouts from Talk Python Training
Python
176
star
7

talk-python-transcripts

Transcripts for the Talk Python To Me episodes
145
star
8

fastapi-chameleon

Adds integration of the Chameleon template language to FastAPI. #pypackage
Python
139
star
9

async-await-jetbrains-webcast

Python
127
star
10

pyscript-pwa-example

JavaScript
106
star
11

ten-tips-for-pythonic-code-jetbrains-webcast

JetBrains / PyCharm webinar: 10 Tips for Pythonic Code by Michael Kennedy
Python
101
star
12

consuming_services_python_demos

Consuming HTTP and SOAP services in Python course handouts
Python
96
star
13

cookiecutter-course

Handout materials for our course on CookieCutter at Talk Python Training
Python
72
star
14

cookiecutter-pyramid-talk-python-starter

An opinionated Cookiecutter template for creating Pyramid web applications starting way further down the development chain. This cookiecutter template will create a new Pyramid web application with email, sqlalchemy, rollbar, and way more integrated.
Python
67
star
15

markdown-subtemplate

A template engine to render Markdown with external template imports and basic variable replacements. #pypackage
Python
63
star
16

restful-services-in-pyramid

RESTful / HTTP services in Pyramid and Python course handout materials
Python
58
star
17

umami-python

Umami Analytics Client for Python
Python
58
star
18

urlify

A simple macOS app to create valid file and url names from clipboard text. #pypackage
Python
52
star
19

write-pythonic-code-for-better-data-science-webcast

Python
41
star
20

python_bytes_show_notes

Show notes from the Python Bytes podcast
Python
40
star
21

cache-tier

Imagine you have a set of static files you want to serve to the world. Cache-tier allows you to quickly spin up a Linux web server in a location with cheap, plentiful bandwidth and serve those files to your users.
Python
31
star
22

ten-tips-python-web-devs

Repo for topics covered during the presentation
JavaScript
30
star
23

python-shorts

Learn Python tips, tools, and techniques in around 5 minutes each.
Python
30
star
24

pycon-sk-pythonic-talk

Python
29
star
25

docker-build-fastapi-app-april-2021

Python
27
star
26

jetbrains-webcast-build-with-mongodb

Code and handouts for my JetBrains webcast recorded January 30, 2018
Python
26
star
27

improve-mvc-perf-with-async-views

C#
25
star
28

pythons-gc-and-orms

A simple project to explore the number of GCs when doing basic ORM work.
Python
25
star
29

mongodb-query-helper-for-dotnet

C#
24
star
30

streamdeck-developer-profiles

A set of profiles for Elgato's Stream Deck aimed at programming tools
24
star
31

mastering-pycharm-course

Course demos and handouts for Talk Python's Mastering PyCharm course
24
star
32

listmonk

Listmonk Email App API Client for Python
Python
24
star
33

build-pypi-mongodb-webcast-series

Code demos and hand-outs for my webcast series with MongoDB (May - June 2018)
Python
22
star
34

optimistic_concurrency_mongodb_dotnet

This c# library adds optimistic concurrency control to MongoDB and acts as a MongoDB ORM foundation.
C#
20
star
35

chameleon_partials

Simple reuse of partial HTML page templates in the Chameleon template language for Python web frameworks. #pypackage
Python
14
star
36

server-hot-reload

Include in your web projects for dev-time auto reloading of web browser when any change is detected in content.
JavaScript
13
star
37

wakeup

A little Python app to make sure your server is warmed up
Python
10
star
38

pycon-sk-mongodb-workshop

Python
7
star
39

EssentialPythonDemos

Essential Python Demos
6
star
40

pyramid-web-builder-python-gui

Python
6
star
41

python-mongodb-intro-jetbrains-webcast

Demo code for my webcast on MongoDB hosted by the PyCharm team
6
star
42

managed_system_hooks

The class library can be used to create any type of system hook. There are two that come pre-built: MouseHook and KeyboardHook. We have also included specialized versions of these classes called MouseHookExt and KeyboardHookExt respectively. Following the model set by those classes, you can easily build system hooks for any of the 15 hook event types in the Win32 API. Also, the entire class library comes with a compiled HTML help file which documents the classes. Be sure to look at this help file if you decide to use this library in your applications.
C#
6
star
43

web-apps-hotkeys

C#
5
star
44

write-pythonic-code-va-meetup

Python
4
star
45

pyramid-cookiecutter-starter-chameleon

Python
4
star
46

windows-python-compatibility-pack

A few commands to make the command prompt identical with macOS and Linux terminals
Batchfile
4
star
47

tinydb-sample-blog

A (very) simple demo app using TinyDb
Python
4
star
48

python-virtual-conf-web-tips

Code and demos from my Python Virtual Conference 2020 talk
Python
4
star
49

fastapi-twitch-examples

Python
4
star
50

talk-python-search-service

An open-source adaption of the high perf search engine powering Talk Python's web properties
Python
3
star
51

enhanced_aspnet_mvc_views

Enhanced View Locations for MVC allows you to further organize your ASP.NET MVC views without your action methods or Html.RenderPartial / Html.RenderAction elements knowing or caring about how they are organized or re-organized.
C#
3
star
52

funny-web

Sample repo for funny web app, featured in Up and Running with Git course.
Python
2
star
53

jetbrains-git-webcast-2022

Python
2
star
54

asq

Automatically exported from code.google.com/p/asq
Python
2
star
55

sketchy-rock-paper-scissors

Sample repo for Rock Paper Scissors app, featured in Up and Running with Git course.
Python
2
star
56

text-encoding-aspnet-mvc-by-example

CSS
2
star
57

DevWeek2015

C#
1
star
58

suds_python

Python
1
star
59

python-for-dotnet-devs-ndc-oslo-2016

Live demo materials from my session at NDC Olso 2016.
Python
1
star
60

python-data-driven-nov9

Python
1
star
61

asq.docs

Automatically exported from code.google.com/p/asq.docs
HTML
1
star
62

portland-state-data-sci

Jupyter Notebook
1
star
63

SDDConf2015

C#
1
star
64

python_workshop_demos_april_2018

1
star
65

smarter_web_deploy

A library to extend Microsoft's Web Deploy feature in Visual Studio to create reliable and fast deploys on production sites running on IIS and Windows Servers.
C#
1
star