-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Build misc examples #6868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build misc examples #6868
Conversation
This reverts commit 0d347a4.
newdtype = np.dtype(rec.dtype.descr + list(zip(names, dtypes))) | ||
old_dtypes = rec.dtype.descr | ||
if six.PY2: | ||
old_dtypes = [(a[0].encode('utf-8'), a[1]) for a in old_dtypes] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit less cryptic variant: old_dtypes = [(name.encode('utf-8'), dt) for name, dt in old_dtypes]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed but I am not sure this is the right solution anyway. The recarray can handle unicode keys it's only that np.dtype cannot. We should probably do this in a completely different way
I am inclined to merge this as-is. It improves things and we should not let the perfect be the enemy of the good here. |
I will at least implement @Kojoley's suggestion |
Implemented @Kojoley's sugestion. The proper solution is most likely to use |
Fixes #6866
urllib has moved from python 2 to 3. file is no more.
In mlab:
iterkeys was being called on the keys instead of the dict.
Unicode strings need to be encoded on python2 to be used in np.dtype
Should probably still add some tests to test_mlab.