Does Python have a concept of class properties (static properties if you may)? I know there are class attributes, but I can't just use one. It's very critical that I control what values can bet set as the class attribute, which I can use the property setter to do.

Recommended Answers

All 2 Replies

After some research, I determined that I'd have to use a metaclass, which is something I don't really want to get into. I was hoping that there was some other solution. I'm probably going to just mark the attribute with a _ to warn other programmers not to interfere with it.

You may want to take a look at __slots__

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.