Skip to content

Commit 23b764f

Browse files
committed
Show difference with setting class field
1 parent 10e570f commit 23b764f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

examples/reactive.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def changed(self, name, value):
2828
product2 = Product(name="Drill", count=6, price=500, service=False)
2929

3030
def increment_count(event):
31+
# Increment the default value on the class.
32+
# This does nothing for existing product instances, such as product1 and product2.
33+
# Future instance will use the new default value.
34+
Product.count += 10
35+
36+
# This is what you really want to do. Increment the instance's count.
3137
product1.count += 10
3238

3339
def order_hammers(event):

0 commit comments

Comments
 (0)