Artwork

محتوای ارائه شده توسط Real Python. تمام محتوای پادکست شامل قسمت‌ها، گرافیک‌ها و توضیحات پادکست مستقیماً توسط Real Python یا شریک پلتفرم پادکست آن‌ها آپلود و ارائه می‌شوند. اگر فکر می‌کنید شخصی بدون اجازه شما از اثر دارای حق نسخه‌برداری شما استفاده می‌کند، می‌توانید روندی که در اینجا شرح داده شده است را دنبال کنید.https://fa.player.fm/legal
Player FM - برنامه پادکست
با برنامه Player FM !

Selecting Inheritance or Composition in Python

46:02
 
اشتراک گذاری
 

Manage episode 500422164 series 2637014
محتوای ارائه شده توسط Real Python. تمام محتوای پادکست شامل قسمت‌ها، گرافیک‌ها و توضیحات پادکست مستقیماً توسط Real Python یا شریک پلتفرم پادکست آن‌ها آپلود و ارائه می‌شوند. اگر فکر می‌کنید شخصی بدون اجازه شما از اثر دارای حق نسخه‌برداری شما استفاده می‌کند، می‌توانید روندی که در اینجا شرح داده شده است را دنبال کنید.https://fa.player.fm/legal

When considering an object-oriented programming problem, should you prefer inheritance or composition? Why wouldn’t it just be simpler to use functions? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder’s Weekly articles and projects.

Christopher shares an article about structuring code using inheritance, composition, or only functions. We discuss how the piece is a good exploration of the trade-offs of each solution. Unlike the tutorials beginners typically encounter while learning the fundamentals, the article goes much deeper into the “why” of object-oriented programming.

We also share several other articles and projects from the Python community, including a news roundup, processing audio in Python, reasons why you shouldn’t call dunder methods, smuggling arbitrary data through an emoji, an HTML to markdown converter, and a library to convert Python requests into curl commands.

Course Spotlight: Single and Double Underscore Naming Conventions in Python

In this video course, you’ll learn a few Python naming conventions involving single and double underscores (_). You’ll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.

Topics:

  • 00:00:00 – Introduction
  • 00:02:23 – Python 3.13.6 Released
  • 00:02:47 – Django 5.2.5 Released
  • 00:02:55 – Django REST Framework Release v3.16.1
  • 00:03:09 – Narwhals v2.0.0 Released
  • 00:03:22 – mypy 1.17 Released
  • 00:03:42 – PEP 798: Unpacking in Comprehensions
  • 00:04:11 – PEP 799: A Dedicated Profilers Package for Organizing Python Profiling Tools
  • 00:06:12 – PyPI Users Email Phishing Attack
  • 00:07:33 – Django in Action
  • 00:08:00 – Call for proposals deadline - PyCon NL
  • 00:08:59 – Python Audio Processing With pedalboard
  • 00:18:49 – Smuggling Arbitrary Data Through an Emoji
  • 00:21:53 – Don’t Call Dunder Methods
  • 00:28:51 – Video Course Spotlight
  • 00:30:27 – Inheritance Over Composition, Sometimes
  • 00:40:03 – html-to-markdown: HTML to Markdown Converter
  • 00:42:20 – curlify: A library to convert Python requests request object into curl commands
  • 00:44:18 – transfunctions: Support Both Sync and Async
  • 00:45:18 – Thanks and goodbye

Survey:

News:

Topics:

  • Python Audio Processing With pedalboard – The pedalboard library for Python is aimed at audio processing of various sorts, from converting between formats to adding audio effects. This post summarizes a PyCon US talk on pedalboard and its uses.
  • Smuggling Arbitrary Data Through an Emoji – Unicode includes flexibility through the use of variation selectors. These include the ability to change characters through a consecutive series of coding points. But, when used with code points that don’t need them, they’re ignored, so you can hide data in them.
  • Don’t Call Dunder Methods – It’s best to avoid calling dunder methods. It’s common to define dunder methods, but uncommon to call them directly.
  • Inheritance Over Composition, Sometimes – In an older post, Adrian wrote some code using inheritance. He got questions from his readers asking why it wouldn’t just be simpler to use functions. This post re-implements the code with inheritance, composition, and plain old functions, then compares the approaches.

Projects:

Additional Links:

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

Support the podcast & join our community of Pythonistas

  continue reading

268 قسمت

Artwork
iconاشتراک گذاری
 
Manage episode 500422164 series 2637014
محتوای ارائه شده توسط Real Python. تمام محتوای پادکست شامل قسمت‌ها، گرافیک‌ها و توضیحات پادکست مستقیماً توسط Real Python یا شریک پلتفرم پادکست آن‌ها آپلود و ارائه می‌شوند. اگر فکر می‌کنید شخصی بدون اجازه شما از اثر دارای حق نسخه‌برداری شما استفاده می‌کند، می‌توانید روندی که در اینجا شرح داده شده است را دنبال کنید.https://fa.player.fm/legal

When considering an object-oriented programming problem, should you prefer inheritance or composition? Why wouldn’t it just be simpler to use functions? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder’s Weekly articles and projects.

Christopher shares an article about structuring code using inheritance, composition, or only functions. We discuss how the piece is a good exploration of the trade-offs of each solution. Unlike the tutorials beginners typically encounter while learning the fundamentals, the article goes much deeper into the “why” of object-oriented programming.

We also share several other articles and projects from the Python community, including a news roundup, processing audio in Python, reasons why you shouldn’t call dunder methods, smuggling arbitrary data through an emoji, an HTML to markdown converter, and a library to convert Python requests into curl commands.

Course Spotlight: Single and Double Underscore Naming Conventions in Python

In this video course, you’ll learn a few Python naming conventions involving single and double underscores (_). You’ll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.

Topics:

  • 00:00:00 – Introduction
  • 00:02:23 – Python 3.13.6 Released
  • 00:02:47 – Django 5.2.5 Released
  • 00:02:55 – Django REST Framework Release v3.16.1
  • 00:03:09 – Narwhals v2.0.0 Released
  • 00:03:22 – mypy 1.17 Released
  • 00:03:42 – PEP 798: Unpacking in Comprehensions
  • 00:04:11 – PEP 799: A Dedicated Profilers Package for Organizing Python Profiling Tools
  • 00:06:12 – PyPI Users Email Phishing Attack
  • 00:07:33 – Django in Action
  • 00:08:00 – Call for proposals deadline - PyCon NL
  • 00:08:59 – Python Audio Processing With pedalboard
  • 00:18:49 – Smuggling Arbitrary Data Through an Emoji
  • 00:21:53 – Don’t Call Dunder Methods
  • 00:28:51 – Video Course Spotlight
  • 00:30:27 – Inheritance Over Composition, Sometimes
  • 00:40:03 – html-to-markdown: HTML to Markdown Converter
  • 00:42:20 – curlify: A library to convert Python requests request object into curl commands
  • 00:44:18 – transfunctions: Support Both Sync and Async
  • 00:45:18 – Thanks and goodbye

Survey:

News:

Topics:

  • Python Audio Processing With pedalboard – The pedalboard library for Python is aimed at audio processing of various sorts, from converting between formats to adding audio effects. This post summarizes a PyCon US talk on pedalboard and its uses.
  • Smuggling Arbitrary Data Through an Emoji – Unicode includes flexibility through the use of variation selectors. These include the ability to change characters through a consecutive series of coding points. But, when used with code points that don’t need them, they’re ignored, so you can hide data in them.
  • Don’t Call Dunder Methods – It’s best to avoid calling dunder methods. It’s common to define dunder methods, but uncommon to call them directly.
  • Inheritance Over Composition, Sometimes – In an older post, Adrian wrote some code using inheritance. He got questions from his readers asking why it wouldn’t just be simpler to use functions. This post re-implements the code with inheritance, composition, and plain old functions, then compares the approaches.

Projects:

Additional Links:

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

Support the podcast & join our community of Pythonistas

  continue reading

268 قسمت

All episodes

×
 
Loading …

به Player FM خوش آمدید!

Player FM در سراسر وب را برای یافتن پادکست های با کیفیت اسکن می کند تا همین الان لذت ببرید. این بهترین برنامه ی پادکست است که در اندروید، آیفون و وب کار می کند. ثبت نام کنید تا اشتراک های شما در بین دستگاه های مختلف همگام سازی شود.

 

راهنمای مرجع سریع

در حین کاوش به این نمایش گوش دهید
پخش