3 ms·
I recently found the following bug in some python code at work x = 12 //10 What they where apparently trying to do was to change the value of x while commen
by dagw 7y ago
I recently found the following bug in some python code at work
x = 12 //10
What they where apparently trying to do was to change the value of x while commenting out the old value for reference. Except in python // is integer division and not comments so x was set to 1 instead of 12.
- alexeiz 7y agoThis is silly. One of my personal stupid mistakes in Python is forgetting to delete a trailing comma. The resulting code is still valid, because a trailing comma produces a tuple. a = b,
- dagw 7y agoOr accidentally forgetting a comma like in a = ["long", "list" "of", "strings] which become a = ["long", "listof", "strings"] due to automatic string concatenation