Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

file_obj.read function requires number of bytes to be read as mandatory argument #257

Open
Prakash2403 opened this issue Aug 5, 2022 · 0 comments

Comments

@Prakash2403
Copy link

Example:

Executing

# This raises error
with open('sample.txt') as f:
    data = f.read()

raises an error saying error: missing argument 'sz'. However, when the number of bytes to be read is passed explicitly, it works as expected

# This returns first 100 bytes
with open('sample.txt') as f:
    data = f.read(100)

Ideal Behaviour

If nothing is passed, the whole file should be read and returned.

Possible fix
Assumption: internal/file.seq handles all file operations (read in this case)

Need to make sz and Optional parameter here. And if sz is None, then set sz to the file size.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant