Web
Opt
tools
Property Decorators Config
Class Name
Property Type
Read-Only (@property)
Read-Write (@property + @setter)
Computed (@property with logic)
Attribute Name
Validation
No Validation
Positive Numbers Only
Range Validation (0-10000)
Type Validation (Numeric)
Operation
Create Object
Get Property
Set Property
Test Validation
Property vs Direct Access
Initial Value
Run Visualization
Console Output
>
Property Decorators Visualization
Current Configuration:
Class:
BankAccount
Property:
balance
Type:
read_write
Validation:
positive
Operation:
create
Value:
1000
Property Type:
Read Write Property
@property decorator implementation
Getter and setter with validation
Property Decorators Structure:
@property
Getter
@balance.setter
Setter
@property (computed)
Computed
Validation Rules:
Positive Validation
Only positive numbers allowed
Applied in @balance.setter method
Property Decorator Benefits:
Controlled access to private attributes
Automatic validation on assignment
Computed values without method calls
Clean API - access like regular attributes
Encapsulation without getter/setter methods
Operation Status:
Object Created
Instance of BankAccount with property decorators created
Generated Code Structure:
class BankAccount:
def __init__(self):
self._balance = 1000
@property
def balance(self):
return self._balance
@balance.setter
def balance(self, value):
if value < 0:
raise ValueError("balance cannot be negative")
self._balance = value
Usage Examples:
Get value:
obj.balance
Set value:
obj.balance = new_value
Direct access (not recommended):
obj._balance
Property decorators make attributes look like regular attributes while providing controlled access