Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
developer:python_tips_and_tricks [2025/02/18 20:36] – external edit 127.0.0.1developer:python_tips_and_tricks [2025/10/23 22:42] (current) – [Execute actions in a Trigger only on certain days of the week] davel17
Line 237: Line 237:
 But this still requires that you define the complete possible list of arguments up-front. What if you wanted your method to collect up any additional arguments? For instance, depending on some of the defined parameters, there might be a difference in what other arguments are passed in? But this still requires that you define the complete possible list of arguments up-front. What if you wanted your method to collect up any additional arguments? For instance, depending on some of the defined parameters, there might be a difference in what other arguments are passed in?
  
-You can do this using *args and %%**kwargs%% in your method definition. In this example, you're allowing the caller to pass in 1 to N number of positional arguments:+You can do this using *args and //''<nowiki>**kwargs</nowiki>''// in your method definition. In this example, you're allowing the caller to pass in 1 to N number of positional arguments:
  
 <code> <code>
Line 300: Line 300:
 # Here's an example of executing actions only on a weekend # Here's an example of executing actions only on a weekend
 if date.today().weekday() in WEEKEND: if date.today().weekday() in WEEKEND:
-    # It's a week day, so execute actions here+    # It's a weekend day, so execute actions here
     # You could directly execute actions if they're simple:     # You could directly execute actions if they're simple:
     indigo.device.turnOn(12345)  # 12345 is the ID of some on/off device     indigo.device.turnOn(12345)  # 12345 is the ID of some on/off device
  • /www/perceptive/wiki/data/attic/developer/python_tips_and_tricks.1739910987.txt.gz
  • Last modified: 2025/02/18 20:36
  • by 127.0.0.1