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

Better get typing for basic list usage #183

Merged
merged 1 commit into from
Mar 17, 2023

Conversation

DeviousStoat
Copy link
Contributor

get is very hard to type but a very nice simple usage of the function is to maybe get a value from a list without worrying about index errors, similarly to get method for dict.
Since using the function on a list with an int path is unequivocal, this usage can be typed. This is the goal of this PR.

@coveralls
Copy link

Coverage Status

Coverage: 100.0%. Remained the same when pulling b57ede9 on DeviousStoat:get-list into a0483e4 on dgilland:develop.

@dgilland dgilland merged commit e3d04c5 into dgilland:develop Mar 17, 2023
@dgilland
Copy link
Owner

@DeviousStoat One thing I realized with the getis that it supports any object. If the passed in object is not a dict or list, then it falls back to using getattr() on the object.

@DeviousStoat DeviousStoat deleted the get-list branch March 18, 2023 15:06
@dgilland
Copy link
Owner

That also means that anything that is using get may need to support a non-dict/list argument(s) (e.g. invoke can invoke a method on any object).

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

Successfully merging this pull request may close these issues.

3 participants