Title: Enhancement for mmap_read: Consistency with standard file read
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 2.7, Python 2.6
Status: closed Resolution: duplicate
Dependencies: Superseder: requires an argument
View: 12021
Assigned To: Nosy List: elwynd, jcea
Priority: normal Keywords:

Created on 2012-10-29 16:20 by elwynd, last changed 2012-10-29 23:58 by jcea. This issue is now closed.

Messages (1)
msg174123 - (view) Author: Elwyn Davies (elwynd) Date: 2012-10-29 16:20
Enhancement requested for module mmap:
Alter the interface of from
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 =
j = json.loads(b)

instead of
f = mmap.mmap(file_desc, file_size)
j = json.load(f)
Date User Action Args
2012-10-29 23:58:02jceasetnosy: + jcea
2012-10-29 16:31:15r.david.murraysetstatus: open -> closed
superseder: requires an argument
resolution: duplicate
stage: resolved
2012-10-29 16:20:11elwyndcreate