FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Implement isinstance by xarus01 · Pull Request #122 · go-python/gpython · GitHub

Implement isinstance - #122

Merged
ncw merged 1 commit into
go-python:masterfrom
xarus01:master
Nov 5, 2019
Merged

Implement isinstance#122
ncw merged 1 commit into
go-python:masterfrom
xarus01:master

Conversation

xarus01 commented Oct 20, 2019

Copy link
Copy Markdown
Contributor

codecov-io commented Oct 20, 2019
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #122 into master will decrease coverage by 0.11%.
The diff coverage is 4.76%.

@@            Coverage Diff             @@
##           master     #122      +/-   ##
==========================================
- Coverage   72.85%   72.74%   -0.12%     
==========================================
  Files          60       60              
  Lines       11949    11970      +21     
==========================================
+ Hits         8706     8707       +1     
- Misses       2709     2729      +20     
  Partials      534      534
Impacted Files Coverage Δ
builtin/builtin.go 77.53% <4.76%> (-2.68%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c23b14...5558a8b. Read the comment docs.

corona10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please rebase your branch first :)

Comment thread builtin/builtin.go Outdated

ncw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think this basically looks sound :-)

I put some comments inline.

I didn't know isinstance recursively unpacked its args - who would have thought!

Comment thread builtin/builtin.go Outdated
Comment thread builtin/builtin.go Outdated
Comment thread builtin/builtin.go Outdated
Comment thread builtin/builtin.go Outdated
var res py.Bool
var class = args[1].(py.Tuple)
for idx := range class {
var new_args []py.Object

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This would be more efficently written

var new_args = []py.Object{args[0], class[idx]}

Comment thread builtin/builtin.go Outdated
if err != nil {
return false, err
}
res = res || temp

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This should say

if res {
    return res
}

to short circuit the rest of the evaluations shouldn't it?

If you do that you can move the definition of res to here.

Comment thread builtin/builtin.go Outdated
}
res = res || temp
}
return res, nil

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Then this can say

return false, nil

Comment thread builtin/builtin.go Outdated
}
default:
{
if args[0].Type() != py.TypeType {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You are checking this for every entry in the args - it would be better checked in builtin_isinstance I think.

ncw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think this looks fine now except for the spare debug!

Can you fix that, squash into one commit and force push, then I'll merge - thank you :-)

Comment thread builtin/builtin.go Outdated

corona10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the contribution @xarus01

I left some nit review.
cc @ncw

Comment thread vm/tests/builtin.py Outdated
Comment thread builtin/builtin.go

ncw commented Nov 5, 2019

Copy link
Copy Markdown
Collaborator

I think this is looking good now - thank you :-)

Apologies for the delay!

I'll merge it now.

ncw merged commit 051f189 into go-python:master Nov 5, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL