
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
simple-classproperty
Advanced tools
classproperty
decoratorThis module provides a simple way for defining class properties.
You can install this Python module via pip:
pip install simple-classproperty
Otherwise the module can be downloaded from PyPI: https://pypi.org/project/simple-classproperty/
from simple_classproperty import ClasspropertyMeta, classproperty
class NewClass(metaclass=ClasspropertyMeta):
_attr = "val"
@classproperty
def attr(cls):
return cls._attr
Don't forget to set the metaclass
!property
):
@attr.setter
def attr(cls, value):
cls._attr = value
@attr.deleter
def attr(cls):
del cls._attr
The classproperty
is also accessible from an instance:
instance = NewClass()
print(instance.attr) # "val"
When the value of the property is changed from an instance object, the class property will be changed. All other instances will have this new value:
instance1 = NewClass()
instance2 = NewClass()
instance1.attr = "new"
print(instance1.attr) # "new"
print(instance2.attr) # "new"
print(NewClass.attr) # "new"
This behavior is the same when a property gets deleted from an instance.
FAQs
Provides a 'classproperty' decorator.
We found that simple-classproperty demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.