I’m writing this function that checks if a list of lists would be a valid sudoku puzzle. When I’m checking the lists for valid integers I’m getting unexpected results.
For example:
lst = [[1,2,3],[2,3,1],[4,2,1]]
for i in lst:
for v in i:
print type(v)
<type 'int'> #all the way through
for i in lst:
for v in i:
if v is int:
print True
Prints nothing, and when I through in:
for i in lst:
for v in i:
if v is not int:
print False
Prints all False? Not sure about what is going on, especially with the type showing they’re integers.
Instead of saying
Which is asking if v is the actual type int
Say
which says v is an instantiated
int(or subclass)Here is an example, first with an integer (or instantiated
int)Next with a type