New submission from Elwyn Davies:

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)

----------
components: Library (Lib)
messages: 174123
nosy: elwynd
priority: normal
severity: normal
status: open
title: Enhancement for mmap_read: Consistency with standard file read
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16358>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to