GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow easier array UDTs, such as `"INT64[3, 3]"` by eriknw · Pull Request #300 · python-graphblas/python-graphblas

Conversation

@eriknw

@eriknw eriknw commented Oct 22, 2022

Copy link
Copy Markdown
Member

This matches the "nicer" repr we have for array UDTs that we already have, so it should be natural to use.

I'm always a little skeptical when extending what numpy does, but I think this is so much easier and more readable.

Quick: can you create a valid numpy array dtype from memory?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@eriknw
Allow easier array UDTs, such as "INT64[3, 3]"
19a087d
@eriknw
eriknw requested a review from jim22k October 22, 2022 03:50
@eriknw eriknw added the enhancement Improve existing functionality or make things work better label Oct 22, 2022
@coveralls

coveralls commented Oct 22, 2022

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.008%) to 98.668% when pulling 19a087d on eriknw:easier_array_udt into d0c41f2 on python-graphblas:main.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eriknw

eriknw commented Oct 22, 2022

Copy link
Copy Markdown
Member Author

It should be noted that record dtypes in numpy can be indexed. For example:

>>> udt = gb.dtypes.lookup_dtype({"x": int, "y": float})
>>> udt
{'x': INT64, 'y': FP64}
>>> udt.np_type
dtype([('x', '<i8'), ('y', '<f8')])
>>> udt.np_type["x"]
dtype('int64')
>>> udt.np_type[0]
dtype('float64')

Array dtypes cannot be indexed:

>>> udt = gb.dtypes.lookup_dtype("INT64[3]")
>>> udt
INT64[3]
>>> udt.np_type
dtype(('<i8', (3,)))
>>> udt.np_type[0]
KeyError: "There are no fields in dtype ('<i8', (3,))."

Might we want to index our dtypes someday, and, if so, does this change our mind about approving this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eriknw
eriknw merged commit 20f3dfb into python-graphblas:main Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jim22k jim22k Awaiting requested review from jim22k

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement Improve existing functionality or make things work better

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@eriknw @coveralls
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.