[Numpy-discussion] fast constructor for arrays from byte data (unpickling?)

Chris Barker chrishbarker at home.net
Tue Aug 7 19:33:30 EDT 2001

Robert Kern wrote:

> Yeah, it took me some fiddling, too, before I got it to work. The Windows call
> to mmap has slightly different semantics in that second argument, but I think
> that if you want to snarf the whole file, then what I do below should work as
> well. The Windows API lets you use 0 to default to the whole file, but that's
> not portable.

[code snipped]

no, the "0 argument does not seem to work on Unix. It seems odd to not
have a way to just snarf the whole file automatically, but so be it

Thanks, that works, but now I am wondering: what I want is a fast and
memory efficient way to get the contents of a fjile into a NujmPy array,
this sure doesn't look any better than:

a = fromstring(file.read()))

thanks anyway,


Christopher Barker,
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------

More information about the NumPy-Discussion mailing list