Skip to content

Implementing the "get" function on a "Dictionary" #106

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

Merged
merged 1 commit into from
Oct 5, 2019
Merged

Implementing the "get" function on a "Dictionary" #106

merged 1 commit into from
Oct 5, 2019

Conversation

Sungmin-Joo
Copy link
Contributor

Implement the "get" function and add unit test.
fixes #105

py/dict.go Outdated

StringDictType.Dict["get"] = MustNewMethod("get", func(self Object, args Tuple) (Object, error) {
var length = len(args)
if length == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe "Effective Go" recommands to use switch for these kind of if-else-if code paths:

switch {
case length == 0:
   // ...
case length > 2:
   // ...
}
...

Copy link
Member

@sbinet sbinet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nit picks, but LGTM otherwise.

Implement the "get" function and add unit test.
fixes #105
@Sungmin-Joo
Copy link
Contributor Author

Sungmin-Joo commented Oct 4, 2019

@sbinet
Can I ask you to confirm my PR once again?

Copy link
Collaborator

@corona10 corona10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@corona10 corona10 merged commit f3df7a4 into go-python:master Oct 5, 2019
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.

The "get" function is not implemented in the Dict.
3 participants