Python Underscore (_) Guide Best Practices & Examples

Publicado em: 12 Julho 2024
no 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  


Nesta página do site você pode assistir ao vídeo on-line Python Underscore (_) Guide Best Practices & Examples duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Programming Is Fun 12 Julho 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 871 vezes e gostou 30 espectadores. Boa visualização!