-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Rename haskey
to hasindex
#25105
Rename haskey
to hasindex
#25105
Conversation
Seems fine as a rename, but what does |
Ref #18843 |
CI failure is due to missing docstring:
|
Looking at this, I'm not sure I like it as much as I thought I would (unlike the |
I don't see the problem personally. An array "has" an index if it's a valid index according e.g. to |
The problem is the |
It's hard to define in general, but it's pretty clear for each given type whether an index exists or not. Any index which can be passed to |
Yes, is there anything wrong with the definition that |
Do you also plan to change |
Great questions, Jameson. First, it seems It's an important insight that arrays have multiple version of keys/indices (there are at least three ways of indexing, one linear indexing Maybe we can just overload It's for reasons like this that I always found linear indexing to be something distinct from standard indexing, potentially deserving a different function entirely. (E.g. maybe linear indices are tokens, not keys?) |
Writing
Maybe so. But if linear indexing is not the standard, and multidimensional indices are, what does it mean to say And if we need to overload it, what should we define it to generically mean? |
Closing as this was pre-1.0. |
Part of #25104.
Basically, the idea is to replace our "key" terminology with "index" terminology, for consistency and to reduce the number of words used to describe the same thing. After discussion, it seems that "index" makes some sense for arrays and dictionaries, while "key" seems wrong for arrays, so we'd unify these in the direction of "index".