If you’ve been using Python for a while, you’ve already used descriptors, even if you’ve never written one yourself. @property, instance methods, cached attributes, ORM fields… all of them rely on the same mechanism. I wrote a deep dive on how Python descriptors work under the hood, how attribute access is resolved, and when descriptors are (and aren’t) a good idea. 👉 https://lnkd.in/dudSFGpE
Raphael Nogueira’s Post
More Relevant Posts
-
Learn the Go-inspired approach to Python interface design — narrow, single-method protocols that compose into flexible contracts without inheritance or ABC overhead. https://lnkd.in/dSX7vahf
To view or add a comment, sign in
-
Python Tip: Understand the Hierarchy of Exceptions Catching Exception everywhere might feel safe. It’s not. Python exceptions follow a clear hierarchy, from BaseException at the top, down to specific errors like ValueError, TypeError, FileNotFoundError, and more. And here’s the insight: ->The more specific your exception handling, the more predictable your system becomes. Catching broad exceptions hides real bugs. Catching specific ones makes your code intentional. Professional Python isn’t about handling errors. It’s about handling the right errors. Know the hierarchy. Write precise except blocks. Build resilient systems. FOLLOW FOR MORE PYTHON TIPS AND INSIGHTS #Python #ErrorHandling #CleanCode #SoftwareEngineering #ProgrammingTips
To view or add a comment, sign in
-
-
🚀 Built a Simple To-Do List App using Python 📝 Today I worked on a small but useful Python project — a To-Do List application. This project helped me practice functions, loops, and list operations in a practical way. 🔹 Features included: • Add new tasks • View all tasks • Remove completed tasks • Simple menu-driven interface • User input handling This project improved my understanding of how Python can be used to build real-world utilities, even with basic concepts like lists and functions. Step by step, turning fundamentals into functional projects 💡
To view or add a comment, sign in
-
-
Now that Python has the clean, stripped-down blueprint (the AST) from Part 2, it needs to figure out exactly what kind of data it's dealing with before it takes action. In this video, you see Python closely examining the two 1s from your code. It has a "lightbulb" moment: it recognizes that both of these are whole numbers (which programmers call integers). This is a super important step. If those 1s were text words instead of numbers, Python would handle them completely differently. But because it confirms they are both solid numbers, it reaches into its internal toolbox and prepares the exact "math tool" designed specifically for adding integers together. Basically, Part 3 is just Python confirming the type of ingredients it has, so it knows exactly which cooking tool to use!
To view or add a comment, sign in
-
New alpha of Python 3.15 just dropped, and there's a measurable speedup (especially with the JIT on, and ESPECIALLY in the free-threaded build) over previous point releases and even alphas of 3.15. Biased as I might be for saying this, I'm convinced Python's existing presence and continued improvement -- not just in speed but also in tooling, both first- and third-party -- will let it prevail over those positioned as challengers to its throne: Julia, Mojo, etc. As for Rust, it's fast becoming a companion to Python as much as any potential replacement. Yes, you're still going to pick Rust where it makes technological sense, but plenty of scenarios still exist where Rust runs hand-in-hand with Python rather than eclipsing it.
To view or add a comment, sign in
-
I see a lot of Python developers jump straight into frameworks, async code, or AI tools, but still struggle with bugs they can’t explain. Often, the problem isn’t “advanced Python.” It’s a missing understanding of variable scope. Local, global, and nonlocal variables sound simple… until they quietly change how your code behaves. I’ve been bitten by this myself more times than I’d like to admit. That’s why I wrote a clear, example-driven guide that focuses on how Python really thinks about variables and not just definitions. 👉 Read it here: https://lnkd.in/djp6HJdD #Python #Programming #LearnToCode #DeveloperEducation
To view or add a comment, sign in
-
#Python #PythonTips #SoftwareDevelopment #DataEngineering #Programming 💡 Most Python devs use generators. Very few understand how they actually work. Here's what's happening under the hood when a generator pauses: Python stores a Frame object with every local variable and the exact instruction to resume on — no threads, no magic, just a smart data structure. And beyond next(), generators have 3 more methods worth knowing: send() — stateful two-way communication throw() — inject errors mid-stream close() — trigger cleanup via GeneratorExit Part 2 of my generators series is live — https://lnkd.in/g89xgmfv Who forgot to "prime" a generator before calling send()and got confused? 😅
To view or add a comment, sign in
-
Quick Python question: Why does this happen? A variable works perfectly inside a function… but suddenly behaves differently outside of it. For many developers, this is where Python variable scope becomes confusing. Understanding how Python handles local, global, and nonlocal variables can eliminate a surprising number of bugs and make your code much easier to reason about. I wrote a short guide that explains the concept clearly with practical examples. 👉 https://lnkd.in/dY8az6hc If you're working with Python and want to strengthen your fundamentals, this is a concept worth mastering. #Python #Programming #SoftwareDevelopment #LearnPython #CodingTips
To view or add a comment, sign in
-
Things are getting wild in Python 🐸 We’ve launched Python Wild - a trio of animal-themed beginner projects that introduce graphics in Python, all available in our new Code Editor, where instructions, code, and output sit side by side. No tab-switching. We’ve launched Python Wild - a trio of animal-themed beginner projects, all available in our new Code Editor, where everything sits side by side: instructions, code, and output. No tab-switching. Meet the projects: 🐞 Dot the bug – rpf.io/dot-the-bug 🐍 Wiggle the snake – rpf.io/wiggle-the-snake 🐸 Hop the frog – rpf.io/hop-the-frog
To view or add a comment, sign in
-
-
Solved problem 347 in Leetcode! Solution Python: class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: count_nums = {} for num in nums: count_nums[num] = count_nums.get(num, 0) + 1 array_nums = [[] for i in range(len(nums) + 1)] for num, count in count_nums.items(): array_nums[count].append(num) result = [] for i in range(len(nums), 0, -1): for num in array_nums[i]: result.append(num) if len(result) == k: return result
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