-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
DOC: Fix code that generates the table in the 'Casting Rules' section. #14558
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,45 +228,47 @@ can generate this table for your system with the code given in the Figure. | |
|
||
.. admonition:: Figure | ||
|
||
Code segment showing the "can cast safely" table for a 32-bit system. | ||
Code segment showing the "can ca 8000 st safely" table for a 64-bit system. | ||
Generally the output depends on the system; your system might result in | ||
a different table. | ||
|
||
>>> mark = {False: ' -', True: ' ✓'} | ||
>>> def print_table(ntypes): | ||
... print 'X', | ||
... for char in ntypes: print char, | ||
... print('X ' + ' '.join(ntypes)) | ||
... for row in ntypes: | ||
... print row, | ||
... print(row, end='') | ||
... for col in ntypes: | ||
... print int(np.can_cast(row, col)), | ||
... print(mark[np.can_cast(row, col)], end='') | ||
... print() | ||
... | ||
>>> print_table(np.typecodes['All']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, did this line vanish completely? I had missed that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, fixed. I'll stop force-pushing until everything looks right. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I honestly do not care for this small change. Lets juts get it done :). |
||
X ? b h i l q p B H I L Q P e f d g F D G S U V O M m | ||
? 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | ||
b 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 | ||
h 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1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0 0 0 0 0 0 0 0 1 1 1 1 0 0 | ||
U 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 | ||
V 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 | ||
O 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 | ||
M 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 | ||
m 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 | ||
? ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
b - ✓ ✓ ✓ ✓ ✓ ✓ - - - - - - ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
h - - ✓ ✓ ✓ ✓ ✓ - - - - - - - ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
i - - - ✓ ✓ ✓ ✓ - - - - - - - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
l - - - - ✓ ✓ ✓ - - - - - - - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
q - - - - ✓ ✓ ✓ - - - - - - - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
p - - - - ✓ ✓ ✓ - - - - - - - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
B - - ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
H - - - ✓ ✓ ✓ ✓ - ✓ ✓ ✓ ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
I - - - - ✓ ✓ ✓ - - ✓ ✓ ✓ ✓ - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
L - - - - - - - - - - ✓ ✓ ✓ - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
Q - - - - - - - - - - ✓ ✓ ✓ - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
P - - - - - - - - - - ✓ ✓ ✓ - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - ✓ | ||
e - - - - - - - - - - - - - ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - - | ||
f - - - - - - - - - - - - - - ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - - | ||
d - - - - - - - - - - - - - - - ✓ ✓ - ✓ ✓ ✓ ✓ ✓ ✓ - - | ||
g - - - - - - - - - - - - - - - - ✓ - - ✓ ✓ ✓ ✓ ✓ - - | ||
F - - - - - - - - - - - - - - - - - ✓ ✓ ✓ ✓ ✓ ✓ ✓ - - | ||
D - - - - - - - - - - - - - - - - - - ✓ ✓ ✓ ✓ ✓ ✓ - - | ||
G - - - - - - - - - - - - - - - - - - - ✓ ✓ ✓ ✓ ✓ - - | ||
S - - - - - - - - - - - - - - - - - - - - ✓ ✓ ✓ ✓ - - | ||
U - - - - - - - - - - - - - - - - - - - - - ✓ ✓ ✓ - - | ||
V - - - - - - - - - - - - - - - - - - - - - - ✓ ✓ - - | ||
O - - - - - - - - - - - - - - - - - - - - - - ✓ ✓ - - | ||
M - - - - - - - - - - - - - - - - - - - - - - ✓ ✓ ✓ - | ||
m - - - - - - - - - - - - - - - - - - - - - - ✓ ✓ - ✓ | ||
|
||
|
||
You should note that, while included in the table for completeness, | ||
|
Uh oh!
There was an error while loading. Please reload this page.