Created
February 8, 2024 02:10
-
-
Save Alwinfy/f445c666651c8c21f097382b3fbb7987 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def modifyat(ls, ix, fn): | |
return ls[:ix] + (fn(ls[ix]),) + ls[ix + 1:] | |
def global_counter(): | |
code = global_counter.__code__ | |
global_counter.__code__ = code.replace(co_consts = modifyat(code.co_consts, len(code.co_consts) - 1, (1).__add__)) | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment