Comment

Comment by Chris2048

I believe all functions are object in python, so you can add attributes to them, but you'd be better of creating a class with a __call__ method. Relevant scope can be captured in the class __init__.

Classes themselves can hold multiple functions/methods, and if you want a function that carries state, maybe a generator would be useful?

parent Chris2048 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton