• Home
  • About
    • About The Coder
    • Language List
  • Code Rules
    • #1: Clarity Trumps Everything
    • #2: Source Code is for Humans
    • #3: Don’t Ignore Warnings
    • #4: Comment As You Go
    • #5: Always Use Parentheses
    • #6: Always Define Literals
    • #7: Never Repeat Yourself
  • CS-101
  • Python-101
  • Simple Tricks
  • Guestbook

The Hard-Core Coder

~ I can't stop writing code!

The Hard-Core Coder

Tag Archives: Python decorator

Python Decorators, more

20 Monday Oct 2025

Posted by Wyrd Smythe in Python

≈ 2 Comments

Tags

Python 101, Python code, Python decorator, Python descriptors

Last time I explored a number of useful Python decorators. The post was a revisit to a topic I first posted about five years ago [see Python Decorators, part 1 and Python Decorators, part 2]. Back then I didn’t really know what to do with decorators, but I could see they were useful.

Since then, I’ve found many applications for them, hence the revisit to the topic. In this post, we’ll continue looking at useful applications. If nothing else, they may provide some ideas for decorators of your own.

Continue reading →

Python Decorators, redux

13 Monday Oct 2025

Posted by Wyrd Smythe in Python

≈ 2 Comments

Tags

Python 101, Python code, Python decorator

I wrote about Python decorators five years ago. [See Python Decorators, part 1 and Python Decorators, part 2] At the time, they were new to me, and I hadn’t thought of good use cases for them. Or really, even just good ways to use them.

But that changed during the last five years as I’ve had occasions to actually use decorators in code. They are extremely handy in certain situations. Today’s post takes a more useful look at Python decorators.

Continue reading →

Python Decorators, part 2

25 Saturday Apr 2020

Posted by Wyrd Smythe in Python

≈ 3 Comments

Tags

Aspect-Oriented Programming, computer language, programming language, Python 101, Python code, Python decorator

Last time I began exploring Python decorators, which are a way of having one function “wrap” another function. Because the wrapper has access to both the input parameters and the return value, it can modify these values (unbeknownst to the inner function).

This time I pick up where I left off by exploring decorators modifying return values, decorators that take parameters, and decorators in classes.

Continue reading →

Python Decorators, part 1

24 Friday Apr 2020

Posted by Wyrd Smythe in Python

≈ 5 Comments

Tags

Aspect-Oriented Programming, Python 101, Python code, Python decorator

I’ve been playing around with what Python calls decorators. They’re a built-in way of implementing Aspect-Oriented Programming techniques in Python. In fact, they’re quite powerful.

Since they aren’t a common language feature, they can be a little confusing at first, so I thought I’d try my hand at laying out how they work.

Continue reading →

Follow The Hard-Core Coder on WordPress.com

The Posts

  • Python Tk Calculator App
  • Tk Windows in Python
  • Dual Numbers in Python
  • Python Decorators, more
  • Python Decorators, redux
  • Byte Multiplication Trick
  • Parsing Multipart Form Data
  • Simple Python Tricks #18
  • Simple Python Tricks #17
  • Simple Python Tricks #16

The Topics

  • Blog (4)
  • CS101 (37)
  • Fun (36)
  • Interesting (5)
  • Opinion (12)
  • Python (59)
  • Stories (15)

The Month

December 2025
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Nov    

The Past

Posts

RSS Feed

Comments

RSS Feed

The Main Blog

Visit Logos con carne

Lots of wyrds... with meat!

The Author

Wyrd Smythe

Wyrd Smythe

The canonical fool on the hill watching the sunset and the rotation of the planet and thinking what he imagines are large thoughts.

View Full Profile →

Create a website or blog at WordPress.com

  • Subscribe Subscribed
    • The Hard-Core Coder
    • Already have a WordPress.com account? Log in now.
    • The Hard-Core Coder
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar