Skip to content

Implement range object - #87

Merged
corona10 merged 4 commits into
go-python:masterfrom
HyeockJinKim:issue86
Sep 22, 2019
Merged

Implement range object#87
corona10 merged 4 commits into
go-python:masterfrom
HyeockJinKim:issue86

Conversation

@HyeockJinKim

Copy link
Copy Markdown
Contributor

Implement __repr__, __str__, __eq__, __ne__ of range

Fixes#86

Comment threadpy/range.go Outdated
}

func (r *Range) repr() (Object, error) {
var out bytes.Buffer

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.

consider using strings.Builder instead? (needs Go >= 1.10, though)

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.

strings.Builder is more recommended way :)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I modified the code. Would you please review it again?

@codecov-io

codecov-io commented Sep 20, 2019

Copy link
Copy Markdown

Codecov Report

Merging #87 into master will increase coverage by 0.05%.
The diff coverage is 74.07%.

Impacted file tree graph

@@ Coverage Diff @@## master #87 +/- ##
=========================================
+ Coverage 68.84% 68.9% +0.05% 
=========================================
Files 59 60 +1 Lines 10545 10599 +54 =========================================
+ Hits 7260 7303 +43 - Misses 2775 2780 +5 - Partials 510 516 +6
Impacted FilesCoverage Δ
py/range_repr110.go70% <70%> (ø)
py/range.go80.86% <76.47%> (+0.62%)⬆️
py/internal.go41.34% <0%> (+0.48%)⬆️

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 261242c...d886727. Read the comment docs.

__repr__ print start, stop of range
if step is not one, step is also printed
Fixesgo-python#86
__eq__ compare length, start, step of range
Comment threadpy/range.go Outdated
}

func (r *Range) repr() (Object, error) {
var b strings.Builder

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.

@HyeockJinKim
HyeockJinKimforce-pushed the issue86 branch 2 times, most recently from 2a572a1 to f222b3dCompareSeptember 20, 2019 18:26
strings.Builder is supported since v1.10,
so split files for older versions

@corona10corona10 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.

LGTM
@sbinet Can you please take a look?

@corona10
corona10 merged commit 37cc47f into go-python:masterSep 22, 2019
Sign up for freeto 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.

Implement range object

4 participants

@HyeockJinKim@codecov-io@sbinet@corona10