Python Underscore (_) Guide Best Practices & Examples

Publicado el: 12 julio 2024
en el canal de: Programming Is Fun
871
30

In this video, we dive deep into the various uses of underscores in Python and how they can help you write cleaner, more maintainable code.

What you'll learn:

1. ⚙️ Single underscores (_) in interactive interpreters and throwaway variables.
2. 🔒 Single leading underscores (_var) for indicating internal use.
3. 🔐 Double leading underscores (__var) for name mangling and avoiding subclass conflicts.
4. ✨ Double leading and trailing underscores (var) for special methods and magic functions.
5. 📦 Leading underscores in module names for indicating internal modules in a package.

We'll also walk through a practical example of structuring a Python package with internal and public modules, demonstrating the importance of using underscores to control the public API. By the end of this video, you'll have a solid understanding of how to use underscores effectively in your Python projects.

⏰ * Time Stamp:

00:00 Introduction of Underscores
00:58 Single Underscore (_) Usage
05:10 Single Leading Underscore (_var) Usage
07:05 Double Leading Underscore (__var) Usage
10:38 Double Leading and Trailing Underscore (__var__) Usage
12:52 Leading Underscore in Module Names (Practical Example: Creating a Python Package)


📁 Source Code: https://github.com/AbhisheakSaraswat/...

👉 *Python NumPy Playlist:    • Python Numpy Tutorial  

👉 Python Excel Automation:    • Excel Automation Using Python  

👉 Python Teaser:    • A Beautiful Python Programming Teaser | In...  

👉 Python Pandas Tutorial:    • Python Pandas Tutorial | What is Pandas | ...  

👉 Python Playlist:    • Python Tutorial for Beginners  

👉 Python Data Structure Playlist:    • Python Data Structure  

👉 Python OOPs Playlist:    • Object Oriented Programming Tutorials Usin...  

👉 Python Project for Data Analysis- Exploratory Data Analysis | Data Analyst Project :    • Python Data Science: Analyzing LinkedIn Co...  

👉 Telegram Link: https://t.me/+32-TodtiOvo2Njk9
👉 Medium Story: 📖   / programmingisfun  
👉 LinkedIn:   / abhisheak-saraswat  
👉 ProgrammingIsFun:   / 10365183  


En esta página del sitio puede ver el video en línea Python Underscore (_) Guide Best Practices & Examples de Duración hora minuto segunda en buena calidad , que subió el usuario Programming Is Fun 12 julio 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 871 veces y le gustó 30 a los espectadores. Disfruta viendo!