Skip to content
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

Implement type key-word-argument for numba.typed.List constructor #5873

Open
esc opened this issue Jun 16, 2020 · 0 comments
Open

Implement type key-word-argument for numba.typed.List constructor #5873

esc opened this issue Jun 16, 2020 · 0 comments
Labels
discussion An issue requiring discussion feature_request

Comments

@esc
Copy link
Member

esc commented Jun 16, 2020

Since the inception of the numba.typed.List the List.empty_list factory method has been a crutch to get the code working. Originally, it was supposed to be called List.empty -- however due to "reasons" this caused a conflict with numba.typed.Dict.empty (investigation to follow) and so it now has it's current unwieldy form.

Now that numba.typed.List has a way to be initialized in a Pythonic fashion from an iterable (see: #5294), it would be nice to allow the constructor to take type (or typ or type_ to avoid naming conflicts?) as a keyword argument, so as to allow manual specification of the types. As outlined in #5716 the API would look something like:

l = List()                 # empty list with undefined type
l = List(type=int64)       # empty list with defined type
l = List(iter)             # list initialized from iter
l = List(iter, type=int64) # list initialized from iter and with items cast to given type

In addition, we may want to deprecate/rename empty_list to _empty_list since it will probably still be used under the hood. And also, some parts of the code-base may need to be updated to reflect this change. Lastly the documentation will need to be scanned and potentially updated to reflect the changes.

Note: this should also be made compatible with NUMBA_DISABLE_JIT as in this case, the keyword argument will just be ignore and a regular Python list will be returned.

@esc esc added feature_request discussion An issue requiring discussion labels Jun 16, 2020
@esc esc added this to the Numba 0.51 RC milestone Jun 16, 2020
@esc esc self-assigned this Jun 16, 2020
@esc esc added this to Selected in numba.typed.List Jun 16, 2020
@stuartarchibald stuartarchibald removed this from the Numba 0.52 RC milestone Oct 5, 2020
@esc esc removed their assignment Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion An issue requiring discussion feature_request
Projects
numba.typed.List
  
Selected
Development

No branches or pull requests

2 participants