Created
September 27, 2018 16:36
-
-
Save justinvanwinkle/6e403a49727093c9b83f0261773d5306 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from itertools import groupby | |
def fuck_my_face(): | |
A = np.ones((5, 2)) # A is array([[1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) | |
B = np.ones((5, 2)) # B is array([[1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]) | |
if (A, B) == (A, B): | |
print('this is fine, tuples use id I guess?') | |
if [A, B] == [A, B]: | |
print('this is also fine') | |
# if A[0] == B[0]: | |
# print('this is no') | |
# if (A[0], B[0]) == (A[0], B[0]): | |
# print('this is no, the id's aren't identical so it tries to check') | |
# if A == B: | |
# print('this is no') | |
print('So this is fine') | |
for (x, y), it in groupby(A, key=tuple): | |
for keyval in it: | |
print('YAY', keyval) | |
# print('But this barfs mysteriously') | |
# for (x, y), it in groupby(A, key=lambda x: x): | |
# for keyval in it: | |
# print('Only one is printed, then exception', keyval) | |
# print('The real pain is that this will not work') | |
# for (x, y), it in groupby(zip(A, B), key=lambda x: x): | |
# for keyval in it: | |
# print('Only one is printed, then exception', keyval) | |
# print('The real pain is that this will not work') | |
# for (x, y), it in groupby(zip(A, B), key=tuple): | |
# for keyval in it: | |
# print('Only one is printed, then exception', keyval) | |
if __name__ == '__main__': | |
fuck_my_face() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment