Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DuckDBPyType.children should return a tuple, not a list #349

OutSquareCapital started this conversation in Ideas
Discussion options

Unless mutability is needed internally, this would improve Datatypes on multiples areas, and would be a first step to a more in-depth future improvement of datatypes API.

  1. better performance and memory efficiency of tuples vs list
  2. possibility to type hint them more precisely. Since a lot of children types are of static length (list, decimal for example), tuples are just plain better than list to statically type.
  3. Later, the "know length" children could be returned as NamedTuples (if that's possible from the C++ side, I have experience with Pyo3 but not much with C++ ), improving the user experience.

I have already code that exist for this and would be happy to make a PR for the static typing side.
Also side note:
would be nice if JSON and BIGINT could be exposed as constant just like the other "simple" types.
https://github.com/OutSquareCapital/pql/blob/7a9f8ec00c55cd8d8c0eadd7dfb85ad6d1aa1dcc/src/pql/sql/_datatypes.py#L63

You must be logged in to vote

Replies: 1 comment

Comment options

Here's something you could use as a starting point on the typing:

We didn't end up using it, but (narwhals-dev/narwhals@b4e4980) shows where we would have

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /