Skip to content

seekable relative_seek() behaviour is confusing #862

@dkrikun

Description

@dkrikun

Based on the example from the docs:

>>> it = seekable((str(n) for n in range(20)))
>>> it.seek(10)
>>> next(it)
'10'
>>> it.relative_seek(-2)  # Seeking relative to the current position
>>> next(it)
'9'

At this point, I would expect the following:

>>> it.relative_seek(-2)
>>> next(it)
'8'

However, the actual return value is '9'.
The reason for that is that, as far as I understand, the method is not actually seeking relative to the current position, but to the end of internal buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pr-welcomeWe are open to PRs that fix this issue - leave a note if you're working on it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions