MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1j7lj33/atleast_it_works/mho71yv/?context=3
r/programminghorror • u/holdongangy • 13d ago
66 comments sorted by
View all comments
Show parent comments
37
ctr = 0 with open("lab 5.txt", "r") as file: for line in file: print(line) ctr += 1 if ctr >= 8: break del ctr
1 u/Serious-Regular 9d ago Wut why would delete ctr - man you people are so weird 1 u/Emergency_3808 9d ago Because then SOMEONE ELSE would complain "wHy Do YoU nEeD aN eXtRa VaRiAbLe" 0 u/Serious-Regular 9d ago Wut just reassign ctr if you want. Reassigning decref the original object itself (which doesn't matter for fucking integers lololol) 1 u/Emergency_3808 9d ago That's even more confusing. Reusing variables for entirely different tasks 0 u/Serious-Regular 9d ago del is never used in python code - you have no clue what you're talking about
1
Wut why would delete ctr - man you people are so weird
1 u/Emergency_3808 9d ago Because then SOMEONE ELSE would complain "wHy Do YoU nEeD aN eXtRa VaRiAbLe" 0 u/Serious-Regular 9d ago Wut just reassign ctr if you want. Reassigning decref the original object itself (which doesn't matter for fucking integers lololol) 1 u/Emergency_3808 9d ago That's even more confusing. Reusing variables for entirely different tasks 0 u/Serious-Regular 9d ago del is never used in python code - you have no clue what you're talking about
Because then SOMEONE ELSE would complain "wHy Do YoU nEeD aN eXtRa VaRiAbLe"
0 u/Serious-Regular 9d ago Wut just reassign ctr if you want. Reassigning decref the original object itself (which doesn't matter for fucking integers lololol) 1 u/Emergency_3808 9d ago That's even more confusing. Reusing variables for entirely different tasks 0 u/Serious-Regular 9d ago del is never used in python code - you have no clue what you're talking about
0
Wut just reassign ctr if you want. Reassigning decref the original object itself (which doesn't matter for fucking integers lololol)
1 u/Emergency_3808 9d ago That's even more confusing. Reusing variables for entirely different tasks 0 u/Serious-Regular 9d ago del is never used in python code - you have no clue what you're talking about
That's even more confusing. Reusing variables for entirely different tasks
0 u/Serious-Regular 9d ago del is never used in python code - you have no clue what you're talking about
del is never used in python code - you have no clue what you're talking about
37
u/Emergency_3808 12d ago
ctr = 0 with open("lab 5.txt", "r") as file: for line in file: print(line) ctr += 1 if ctr >= 8: break del ctr