Skip to content

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

Merged
merged 1 commit into from
Sep 20, 2019

Conversation

WarrenWeckesser
Copy link
Member

The old code was Python 2 only.

@WarrenWeckesser WarrenWeckesser changed the title DOC: Update code that generates the casting table the 'Casting Rules' section. DOC: Fix code that generates the table in the 'Casting Rules' section. Sep 20, 2019
@seberg
Copy link
Member

seberg commented Sep 20, 2019

Seems like a small enough fix, I am good if you just put it in when you feel you are done @WarrenWeckesser. The unicode characters are a nice touch. Hmmm, we have a script flying around somewhere that prints similar tables, but I am too stupid to find it right now.

... for col in ntypes:
... print int(np.can_cast(row, col)),
... print
>>> print_table(np.typecodes['All'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, did this line vanish completely? I had missed that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed. I'll stop force-pushing until everything looks right.

Copy link
Member

Choose a reason for hiding this comment

The 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 :).

@WarrenWeckesser
Copy link
Member Author

Hmmm... looks like shippable took off early for the weekend.

@seberg
Copy link
Member

seberg commented Sep 20, 2019

OK, nvm shippable. Let me put this in, the snippet runs fine for me.

@seberg seberg merged commit 4ff3af3 into numpy:master Sep 20, 2019
@WarrenWeckesser WarrenWeckesser deleted the update-doc-code branch September 21, 2019 00:22
@WarrenWeckesser
Copy link
Member Author

@seberg wrote

we have a script flying around somewhere that prints similar tables,

Just happened to find it: print_coercion_tables.py

@rgommers
Copy link
Member

thanks! I've seen the output of that messing up failed tests recently, but I couldn't locate the source of it

@WarrenWeckesser
Copy link
Member Author

Argh, apparently those Unicode checkmarks aren't drawn with the correct fixed-width when rendered on the web site (at least not with Firefox): https://numpy.org/devdocs/reference/ufuncs.html#casting-rules

If anyone sees a way to get the checkmarks to render correctly, let me know. Otherwise, I'll change the checkmark to, say, the letter Y for yes.

@seberg
Copy link
Member

seberg commented Sep 26, 2019

Hmmm, that is annoying, it works fine for me. My guess is that your font is missing the character, so that it switches over to another one for it? But if that is not just an outlier, we need to replace.

@WarrenWeckesser
Copy link
Member Author

As far as I can tell (a few minutes of searching makes me an expert, right?), there isn't such a thing as a monospace font for all Unicode. Further investigation doesn't seem worthwhile at the moment. I submitted a pull request to change the checkmark to Y: #14595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants