minus-squaredont_lemmee_down@lemm.eetoProgrammer Humor@programming.dev•How should I increment an int?linkfedilinkarrow-up32·2 days agoCreate a python file that only contains this function def increase_by_one(i): # this increments i f=open(__file__).read() st=f[28:-92][0] return i+f.count(st) Then you can import this function and it will raise an index error if the comment is not there, coming close to the most literal way Any code which does not contain the comment “this increments i:” will produce a compile error and fail to run. could be interpreted in python linkfedilink
Create a python file that only contains this function
def increase_by_one(i): # this increments i f=open(__file__).read() st=f[28:-92][0] return i+f.count(st)
Then you can import this function and it will raise an index error if the comment is not there, coming close to the most literal way
could be interpreted in python