-
Notifications
You must be signed in to change notification settings - Fork 95
Implement range object #87
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
Conversation
py/range.go
Outdated
} | ||
|
||
func (r *Range) repr() (Object, error) { | ||
var out bytes.Buffer |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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 Report
@@ 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
Continue to review full report at Codecov.
|
dc62cd0
to
ed5b79e
Compare
__repr__ print start, stop of range if step is not one, step is also printed Fixes go-python#86
__eq__ compare length, start, step of range
ed5b79e
to
896a35d
Compare
py/range.go
Outdated
} | ||
|
||
func (r *Range) repr() (Object, error) { | ||
var b strings.Builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since strings.Builder is not supported at go < 1.10
You need to use version constraints.
Read this article. https://medium.com/@theckman/version-constraints-and-go-c9309be15773
example:
https://github.com/corona10/goimagehash/blob/master/imagehash18.go
https://github.com/corona10/goimagehash/blob/master/imagehash19.go
2a572a1
to
f222b3d
Compare
strings.Builder is supported since v1.10, so split files for older versions
f222b3d
to
5d708b3
Compare
5d708b3
to
d886727
Compare
There was a problem hiding this comment.
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?
Implement
__repr__
,__str__
,__eq__
,__ne__
of rangeFixes #86