Copyright This document has been placed in the public domain. Typeshed repo https://lnkd.in/dpbtuzFs https://lnkd.in/dERgaqgj Donald Knuth's The TeXBook, pages 195 and 196. Hanging indentation is a type-setting style where all the lines in a paragraph are indented except the first line. In the context of Python, the term is used to describe a style where the opening parenthesis of a parenthesized statement is the last non-whitespace character of the line, with subsequent lines being indented until the closing parenthesis. Barry's GNU Mailman style guide https://lnkd.in/ddXsQvSs PEP: 8 Title: Style Guide for Python Code Author: Guido van Rossum <gu ido@python.org>, Barry Warsaw <barry@python.org>, Alyssa Coghlan <nc oghlan@gmail.com> Status: Active Type: Process Created: 05-Jul-2001 Post- History: 05-Jul-2001, 01-Aug-2013
Python Style Guide: Hanging Indentation Explained
More Relevant Posts
-
🚀 Just Published My First Python Library on PyPI! Excited to share that I’ve built and published "common-fun" — a modular Python utility library designed to simplify everyday development tasks. 📦 Install: pip install common-fun 🖥️ Try CLI: common-fun help 🔗 GitHub: https://lnkd.in/gjWRyhpq 🔧 What it includes: • Number utilities (prime, gcd, factorial, etc.) • String processing (palindrome, slugify, etc.) • Array helpers (flatten, chunk, rotate) • Validators (email, URL, password) • File utilities • Performance decorators (timer, retry, caching) • 🔥 CLI support for direct terminal usage 💡 Why I built this: While working on multiple projects, I realized I was repeatedly writing similar utility functions. So I decided to consolidate everything into a clean, reusable, and structured library. ⚙️ Key highlights: • Fully modular architecture • Optimized implementations • CLI tool for quick access • PyPI-ready packaging • Clean documentation This project helped me understand: ✔️ Library design ✔️ Packaging & publishing ✔️ CLI development ✔️ Clean code practices Would love your feedback and suggestions! #Python #OpenSource #Developer #Programming #PyPI #SoftwareDevelopment
To view or add a comment, sign in
-
If you want your python code to be less buggy and easier to maintain and deploy, check out the following FREE, open source tools you can build into your development workflow than can do all that and more. black, ruff, pytest, py-spy, mypy and pre-commit. In my latest article on Towards Data Science I show where to get them, install and use them. Read the article for free using the link in the first comment.
To view or add a comment, sign in
-
If you used Rcpp back in the R days, this will feel familiar. I vibe-coded something over the weekend that does the same thing for Python: write C++ inline, call it like a normal function, get results back as numpy arrays. No build system, no separate files, no compilation step. ``` fn = cppFunction(''' std::vector<double> simulate(int n, double mu) { ... } ''') fn(10000, 2.5) ``` Projects like pybind11 and Cython are better for production C++ projects, but this is for when you just need one fast function right next to your Python code. The code compiles on the first call and is cached forever after. Armadillo works out of the box if you have it installed. https://lnkd.in/gt6YQENq
To view or add a comment, sign in
-
🧠 Python Concept: __all__ (Controlling Imports) Control what your module exposes 😎 ❌ Without __all__ # mymodule.py def public_func(): pass def _private_func(): pass from mymodule import * 👉 Imports everything 👉 Even internal functions ✅ With __all__ # mymodule.py __all__ = ["public_func"] def public_func(): pass def _private_func(): pass from mymodule import * 👉 Only public_func is imported 🧒 Simple Explanation Think of __all__ like a filter 🚫 ➡️ Controls what others can access ➡️ Hides internal stuff ➡️ Keeps code clean 💡 Why This Matters ✔ Better module design ✔ Cleaner APIs ✔ Avoids accidental usage ✔ Professional coding practice ⚡ Real-World Use ✨ Library development ✨ Package design ✨ Large codebases 🐍 Don’t expose everything 🐍 Control your module interface #Python #AdvancedPython #CleanCode #BackendDevelopment #SoftwareEngineering #Programming #DeveloperLife
To view or add a comment, sign in
-
-
Python scope is one of those topics that separates developers who debug fast from those who don't. The language gives you no warning when a variable resolves to an unexpected value. It simply executes, returns a result, and moves on. Tracking down the source of that behaviour - without a solid mental model of how Python resolves names - can cost hours. The LEGB rule isn't complicated. But it's rarely taught with the depth it deserves. I wrote a free guide to change that: → How Python's name resolution actually works under the hood → The LEGB lookup chain with concrete, practical examples → Enclosing scopes and closure behaviour explained clearly → When global and nonlocal are appropriate - and when they signal a design problem → The scope patterns most likely to introduce silent bugs in real codebases Download it free: https://lnkd.in/djp6HJdD #Python #SoftwareEngineering #PythonDevelopment #BackendDevelopment
To view or add a comment, sign in
-
I’ve been using Jupyter notebooks for years, but they tend to get messy once they stop being "temporary". I recently tried marimo, and it feels like a different approach: • notebooks as plain Python files • dependency-based execution (no more weird states) • much cleaner to keep in git What I like most is that it sits somewhere between a notebook and a small app. I also show a real example: using it to recover deleted S3 files. 👉 https://lnkd.in/d_YdRCbd
To view or add a comment, sign in
-
Man i didn't thought this project would take this long, Its not even that many lines of code, However its quite tricky to grasp the coding language of python and modules like pandas and numpy when you are from finance background, Also i didnt used the normal Browser based Jupyter, instead done this entire thing in the VS Code by installing the Jupyter extention as it sometime autocompletes our lines by some predective algorithm built into it. Now instead of mannually making the GST Summary, the same can be done with a single click combining data from different sources. Ofcourse its not that impressive, but better than nothing and theres always areas of improvement.
To view or add a comment, sign in
-
Day 3 of my #100DaysOfCode challenge is complete! 🚀 Day 3 was all about Control Flow and Logical Operators in Python. Writing clean, efficient logic is absolutely essential for filtering and categorizing datasets, so mastering the foundations of if, elif, and else statements is a massive step forward. Here is a breakdown of what I tackled today: ✔️Conditional Statements: Building decision-making logic into code using if, elif, and else. ✔️ Comparison Operators: Teaching Python how to evaluate data using >, <, >=, <=, ==, and !=. ✔️ Logical Operators: Combining multiple conditions using and, or, and not. ✔️ The Modulo Operator (%): Grabbing the remainder of a division, super helpful for identifying even/odd numbers. ✔️Code Blocks & Scope: Understanding indentation rules in Python. To test my logic, I built a "Python Pizza Delivery" program. It calculates a user's final bill based on their size preference and checks for extra toppings using nested conditional statements. Check my code in the comments section #100DaysOfCode
To view or add a comment, sign in
-
-
Day 3 of my #100DaysOfCode challenge is complete! 🚀 Day 3 was all about Control Flow and Logical Operators in Python. Writing clean, efficient logic is absolutely essential for filtering and categorizing datasets, so mastering the foundations of if, elif, and else statements is a massive step forward. Here is a breakdown of what I tackled today: ✔️Conditional Statements: Building decision-making logic into code using if, elif, and else. ✔️ Comparison Operators: Teaching Python how to evaluate data using >, <, >=, <=, ==, and !=. ✔️ Logical Operators: Combining multiple conditions using and, or, and not. ✔️ The Modulo Operator (%): Grabbing the remainder of a division, super helpful for identifying even/odd numbers. ✔️Code Blocks & Scope: Understanding indentation rules in Python. To test my logic, I built a "Python Pizza Delivery" program. It calculates a user's final bill based on their size preference and checks for extra toppings using nested conditional statements. Check my code in the comments section #100DaysOfCode
To view or add a comment, sign in
-
🐍📰 D-Strings Could End Your textwrap.dedent() Days and Other Python News for April 2026 D-strings proposed to kill textwrap.dedent(), Python 3.15 alpha 7 ships lazy imports, GPT-5.4 launches, and Python Insider moves home https://lnkd.in/gG8SQFmT
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development