Skip to content Skip to sidebar Skip to footer
Showing posts with the label Properties

Property Method Without Class

I have a next code global_variable = 1 @property def method(): # Some magic, for example … Read more Property Method Without Class

Python Property Lookup With Custom __setattr__ And __slots__

I have a class that uses __slots__ and makes them nearly immutable by overriding __setattr__ to alw… Read more Python Property Lookup With Custom __setattr__ And __slots__

Followup: Attribute Caching In Superclasses

This is a followup to this question. I have a class which caches an attribute for its subclasses: c… Read more Followup: Attribute Caching In Superclasses

How To List All Class Properties

I have class SomeClass with properties. For example id and name: class SomeClass(object): def _… Read more How To List All Class Properties

Property In Python With @property.getter

I have an intresting behaviour for the following code: class MyClass: def __init__(self): … Read more Property In Python With @property.getter

Overloading Operators On Python Properties

Is it possible to overload an operator on a python property? Something like: class Foo( object ): … Read more Overloading Operators On Python Properties