Skip to content

Commit

Permalink
Show difference with setting class field
Browse files Browse the repository at this point in the history
  • Loading branch information
laffra committed Feb 4, 2025
1 parent 10e570f commit 23b764f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def changed(self, name, value):
product2 = Product(name="Drill", count=6, price=500, service=False)

def increment_count(event):
# Increment the default value on the class.
# This does nothing for existing product instances, such as product1 and product2.
# Future instance will use the new default value.
Product.count += 10

# This is what you really want to do. Increment the instance's count.
product1.count += 10

def order_hammers(event):
Expand Down

0 comments on commit 23b764f

Please sign in to comment.