You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2012-10-29.16:31:15.323>created_at=<Date2012-10-29.16:20:11.136>labels= ['type-feature', 'library']
title='Enhancement for mmap_read: Consistency with standard file read'updated_at=<Date2012-10-29.23:58:02.285>user='https://bugs.python.org/elwynd'
Enhancement requested for module mmap:
Alter the interface of mmap.read from
mmap.read(num)
to
mmap.read([num])
reading the whole file if no argument provided.
The read function in the mmap module (Modules/mmapmodule.c) *requires* an argument whereas for the standard file read function the argument is optional and the function reads the remainder of the file if absent.
The mmap module knows how big the file is, so it should be no problem to internally use the remaining length if no argument is supplied.
This would avoid having to write (for example)
f = mmap.mmap(file_desc, file_size)
b = f.read(file_size)
j = json.loads(b)
instead of
f = mmap.mmap(file_desc, file_size)
j = json.load(f)
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: