pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://github.com/go-python/gpython/pull/106

.css" /> Implementing the "get" function on a "Dictionary" by Sungmin-Joo · Pull Request #106 · go-python/gpython · GitHub
Skip to content

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

Merged
corona10 merged 1 commit into
go-python:masterfrom
Sungmin-Joo:master
Oct 5, 2019
Merged

Implementing the "get" function on a "Dictionary"#106
corona10 merged 1 commit into
go-python:masterfrom
Sungmin-Joo:master

Conversation

@Sungmin-Joo
Copy link
Copy Markdown
Contributor

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

Comment thread 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
Copy Markdown
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
Copy Markdown
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.

Comment thread py/dict.go Outdated
Implement the "get" function and add unit test.
fixes #105
@Sungmin-Joo
Copy link
Copy Markdown
Contributor Author

Sungmin-Joo commented Oct 4, 2019

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

Copy link
Copy Markdown
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

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy