Artwork

Nội dung được cung cấp bởi Real Python. Tất cả nội dung podcast bao gồm các tập, đồ họa và mô tả podcast đều được Real Python hoặc đối tác nền tảng podcast của họ tải lên và cung cấp trực tiếp. Nếu bạn cho rằng ai đó đang sử dụng tác phẩm có bản quyền của bạn mà không có sự cho phép của bạn, bạn có thể làm theo quy trình được nêu ở đây https://vi.player.fm/legal.
Player FM - Ứng dụng Podcast
Chuyển sang chế độ ngoại tuyến với ứng dụng Player FM !

Start Testing Your Python with doctest & Pagination in Django

56:39
 
Chia sẻ
 

Manage episode 328350621 series 2637014
Nội dung được cung cấp bởi Real Python. Tất cả nội dung podcast bao gồm các tập, đồ họa và mô tả podcast đều được Real Python hoặc đối tác nền tảng podcast của họ tải lên và cung cấp trực tiếp. Nếu bạn cho rằng ai đó đang sử dụng tác phẩm có bản quyền của bạn mà không có sự cho phép của bạn, bạn có thể làm theo quy trình được nêu ở đây https://vi.player.fm/legal.

Did you know you can add testing to your Python code while simultaneously documenting it? Using docstrings, you can create examples of how your functions should interact in a Python REPL and test them with the built-in doctest module. This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.

Christopher shares an article by previous guest Mike Driscoll about testing with doctest. This is a great way to get started with testing your own code, and it offers the added benefit of documenting functionality.

We talk about the recent Real Python article “Pagination for a User-Friendly Django App.” Spreading your content across multiple pages can significantly improve the user experience of your web application. This article takes you through configuring Django’s built-in pagination tool and how to combine it with other web tools.

We discuss a recent article about Python type hints and the author’s disappointment. We also include reactions from a couple of online communities.

We cover several other articles and projects from the Python community, including why it’s important to close files in Python, how dunder methods are awesome, a bidirectional Python dictionary, prettier git diffs, and a command-line game to learn git.

Spotlight: Python Coding Interviews: Tips & Best Practices

In this step-by-step course, you’ll learn how to take your Python coding interview skills to the next level and use Python’s built-in functions and modules to solve problems faster and more easily.

Topics:

  • 00:00:00 – Introduction
  • 00:02:15 – PyCon US 2022 Follow-up
  • 00:07:57 – Why Is It Important to Close Files in Python?
  • 00:15:17 – Dunder Methods in Python: The Ugliest Awesome Sauce
  • 00:24:26 – Sponsor: Mailtrap
  • 00:25:08 – Python Testing With doctest
  • 00:28:20 – Python Bidirectional Dictionary
  • 00:30:27 – Pagination for a User-Friendly Django App
  • 00:36:07 – Video Course Spotlight
  • 00:37:27 – Python’s “Type Hints” are a bit of a disappointment to me
  • 00:52:25 – dunk: Prettier Git Diffs
  • 00:53:43 – git-gud: Command-Line Game to Learn git
  • 00:55:40 – Thanks and goodbye

Topic Links:

  • Why Is It Important to Close Files in Python? – Model citizens use context managers to open and close file resources in Python, but have you ever wondered why it’s important to close files? In this tutorial, you’ll take a deep dive into the reasons why it’s important to close files and what can happen if you dont.
  • Dunder Methods in Python: The Ugliest Awesome Sauce – Double-underscore methods, also known as “dunder methods” or “magic methods” are an ugly way of bringing beauty to your code. Learn about constructors, __repr__, __str__, operator overloading, and getting your classes working with Python functions like len().
  • Python Testing With doctest – Python’s doctest module allows you to write unit tests through REPL-like sessions in your docstrings. Learn how to write and execute doctest code. Also available in video.
  • Python Bidirectional Dictionary – Learn about the Bidict library, a bidirectional dictionary where your keys and your values can both be used to look up an item. This can be a useful tool when dealing with mapped data, like country code to country name, where you want to look up either side of the relationship.
  • Pagination for a User-Friendly Django App – In this tutorial, you’ll learn how to serve paginated content in your Django apps. Using Django pagination can significantly improve your website’s performance and give your visitors a better user experience.

Discussion:

Projects:

Additional Links:

Level up your Python skills with our expert-led courses:

Support the podcast & join our community of Pythonistas

  continue reading

198 tập

Artwork
iconChia sẻ
 
Manage episode 328350621 series 2637014
Nội dung được cung cấp bởi Real Python. Tất cả nội dung podcast bao gồm các tập, đồ họa và mô tả podcast đều được Real Python hoặc đối tác nền tảng podcast của họ tải lên và cung cấp trực tiếp. Nếu bạn cho rằng ai đó đang sử dụng tác phẩm có bản quyền của bạn mà không có sự cho phép của bạn, bạn có thể làm theo quy trình được nêu ở đây https://vi.player.fm/legal.

Did you know you can add testing to your Python code while simultaneously documenting it? Using docstrings, you can create examples of how your functions should interact in a Python REPL and test them with the built-in doctest module. This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects.

Christopher shares an article by previous guest Mike Driscoll about testing with doctest. This is a great way to get started with testing your own code, and it offers the added benefit of documenting functionality.

We talk about the recent Real Python article “Pagination for a User-Friendly Django App.” Spreading your content across multiple pages can significantly improve the user experience of your web application. This article takes you through configuring Django’s built-in pagination tool and how to combine it with other web tools.

We discuss a recent article about Python type hints and the author’s disappointment. We also include reactions from a couple of online communities.

We cover several other articles and projects from the Python community, including why it’s important to close files in Python, how dunder methods are awesome, a bidirectional Python dictionary, prettier git diffs, and a command-line game to learn git.

Spotlight: Python Coding Interviews: Tips & Best Practices

In this step-by-step course, you’ll learn how to take your Python coding interview skills to the next level and use Python’s built-in functions and modules to solve problems faster and more easily.

Topics:

  • 00:00:00 – Introduction
  • 00:02:15 – PyCon US 2022 Follow-up
  • 00:07:57 – Why Is It Important to Close Files in Python?
  • 00:15:17 – Dunder Methods in Python: The Ugliest Awesome Sauce
  • 00:24:26 – Sponsor: Mailtrap
  • 00:25:08 – Python Testing With doctest
  • 00:28:20 – Python Bidirectional Dictionary
  • 00:30:27 – Pagination for a User-Friendly Django App
  • 00:36:07 – Video Course Spotlight
  • 00:37:27 – Python’s “Type Hints” are a bit of a disappointment to me
  • 00:52:25 – dunk: Prettier Git Diffs
  • 00:53:43 – git-gud: Command-Line Game to Learn git
  • 00:55:40 – Thanks and goodbye

Topic Links:

  • Why Is It Important to Close Files in Python? – Model citizens use context managers to open and close file resources in Python, but have you ever wondered why it’s important to close files? In this tutorial, you’ll take a deep dive into the reasons why it’s important to close files and what can happen if you dont.
  • Dunder Methods in Python: The Ugliest Awesome Sauce – Double-underscore methods, also known as “dunder methods” or “magic methods” are an ugly way of bringing beauty to your code. Learn about constructors, __repr__, __str__, operator overloading, and getting your classes working with Python functions like len().
  • Python Testing With doctest – Python’s doctest module allows you to write unit tests through REPL-like sessions in your docstrings. Learn how to write and execute doctest code. Also available in video.
  • Python Bidirectional Dictionary – Learn about the Bidict library, a bidirectional dictionary where your keys and your values can both be used to look up an item. This can be a useful tool when dealing with mapped data, like country code to country name, where you want to look up either side of the relationship.
  • Pagination for a User-Friendly Django App – In this tutorial, you’ll learn how to serve paginated content in your Django apps. Using Django pagination can significantly improve your website’s performance and give your visitors a better user experience.

Discussion:

Projects:

Additional Links:

Level up your Python skills with our expert-led courses:

Support the podcast & join our community of Pythonistas

  continue reading

198 tập

Minden epizód

×
 
Loading …

Chào mừng bạn đến với Player FM!

Player FM đang quét trang web để tìm các podcast chất lượng cao cho bạn thưởng thức ngay bây giờ. Đây là ứng dụng podcast tốt nhất và hoạt động trên Android, iPhone và web. Đăng ký để đồng bộ các theo dõi trên tất cả thiết bị.

 

Hướng dẫn sử dụng nhanh