Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implement range object #86

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

Closed
HyeockJinKim opened this issue Sep 20, 2019 · 2 comments · Fixed by #87
Closed

Implement range object #86

HyeockJinKim opened this issue Sep 20, 2019 · 2 comments · Fixed by #87
Assignees

Comments

@HyeockJinKim
Copy link
Contributor

HyeockJinKim commented Sep 20, 2019

Expected Result

>>> range(10)
range(0, 10)
>>> range(10) == range(10)
True
>>> str(range(10))
'range(0, 10)'

Actual Result

>>> range(10)
<range instance at 0xc0002c8380>
>>> range(10) == range(10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    FIXME line of source goes here
TypeError: "unsupported operand type(s) for ==: 'range' and 'range'"
>>> str(range(10))
'<range instance at 0xc0002c8c60>'

The __repr__, __str__, __eq__, and __ne__ functions of the range object are not implemented.

@HyeockJinKim
Copy link
Contributor Author

Can I try this issue?

@corona10
Copy link
Collaborator

Yes please

HyeockJinKim added a commit to HyeockJinKim/gpython that referenced this issue Sep 20, 2019
__repr__ print start, stop of range
if step is not one, step is also printed

Fixes go-python#86
HyeockJinKim added a commit to HyeockJinKim/gpython that referenced this issue Sep 20, 2019
__repr__ print start, stop of range
if step is not one, step is also printed

Fixes go-python#86
HyeockJinKim added a commit to HyeockJinKim/gpython that referenced this issue Sep 20, 2019
__repr__ print start, stop of range
if step is not one, step is also printed

Fixes go-python#86
corona10 pushed a commit that referenced this issue Sep 22, 2019
* Add __repr__, __str__ of range

__repr__ print start, stop of range
if step is not one, step is also printed

Fixes #86

* Add __eq__, __ne__ of range

__eq__ compare length, start, step of range

* Seperate range __repr__ for version constraint

strings.Builder is supported since v1.10,
so split files for older versions

* Add tests for range object
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 a pull request may close this issue.

2 participants