Just pointed out an improvement to the code example.
This commit is contained in:
parent
45511b4a61
commit
9c13bfc40f
|
@ -86,7 +86,7 @@ Since booleans are a subclass of integers, the matrix would continue
|
||||||
to calculate normally, but it will not print as expected. The list
|
to calculate normally, but it will not print as expected. The list
|
||||||
comprehension should be changed to read::
|
comprehension should be changed to read::
|
||||||
|
|
||||||
return [[i==j and 1 or 0 for i in range(m)] for j in range(m)]
|
return [[int(i==j) for i in range(m)] for j in range(m)]
|
||||||
|
|
||||||
There are similiar concerns when storing data to be used by other
|
There are similiar concerns when storing data to be used by other
|
||||||
applications which may expect a number instead of True or False.
|
applications which may expect a number instead of True or False.
|
||||||
|
|
Loading…
Reference in New Issue