What are you working on, Jow Forums?
Last thread:
What are you working on, Jow Forums?
Last thread:
First for decorators
class Button:
def __init__(self):
self.click_handler = None
def on_click(self, func):
self.click_handler = func
def update(self):
click_event_happened = True
if click_event_happened and self.click_handler != None:
self.click_handler()
btn = Button()
@btn.on_click
def handler():
print("Button has been clicked")
btn.update()
>First
you mean zeroth?
OP is zeroth
No, 0P is the 0th poster
Fuckin yikes
is click_event_happened persistent across calls to update?
also you've gained literally nothing over just using func
Just going to be the first in this thread to mention that not all instructions are created equally some take longer than others to execute.
#instructiondescrimination
>What are you working on, Jow Forums?
A shorter fizzbuzz
(,&((;,>)Fizz`Buzz)@":{~+.&3-~0:
This code is disgusting. Never post this again.