[Numpy-discussion] Name of the file associated with a memmap

Robert Kern robert.kern@gmail....
Mon Apr 12 16:39:23 CDT 2010


On Mon, Apr 12, 2010 at 16:14, Brent Pedersen <bpederse@gmail.com> wrote:
> On Mon, Apr 12, 2010 at 1:59 PM, Robert Kern <robert.kern@gmail.com> wrote:
>> On Mon, Apr 12, 2010 at 15:52, Charles R Harris
>> <charlesr.harris@gmail.com> wrote:
>>>
>>> On Mon, Apr 12, 2010 at 2:37 PM, Charles R Harris
>>> <charlesr.harris@gmail.com> wrote:
>>>>
>>>> On Mon, Apr 12, 2010 at 1:55 PM, Brent Pedersen <bpederse@gmail.com>
>>>> wrote:
>>>>>
>>>>> On Mon, Apr 12, 2010 at 9:49 AM, Robert Kern <robert.kern@gmail.com>
>>>>> wrote:
>>>>> > On Mon, Apr 12, 2010 at 04:03, Nadav Horesh <nadavh@visionsense.com>
>>>>> > wrote:
>>>>> >>
>>>>> >> Is there a way to get the file-name given a memmap array object?
>>>>> >
>>>>> > Not at this time. This would be very useful, though, so patches are
>>>>> > welcome.
>>>>> >
>>>>> > --
>>>>> > Robert Kern
>>>>> >
>>>>> > "I have come to believe that the whole world is an enigma, a harmless
>>>>> > enigma that is made terrible by our own mad attempt to interpret it as
>>>>> > though it had an underlying truth."
>>>>> >  -- Umberto Eco
>>>>> > _______________________________________________
>>>>> > NumPy-Discussion mailing list
>>>>> > NumPy-Discussion@scipy.org
>>>>> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>> >
>>>>>
>>>>> this sounded easy, so i gave it a shot:
>>>>> http://projects.scipy.org/numpy/ticket/1451
>>>>>
>>>>> i think that works.
>>>>
>>>> Looks OK, I applied it. Could you add some documentation?
>>>>
>>>
>>> And maybe the filename should be the whole path? Thoughts?
>>
>> Yes, that would help. While you are looking at it, you may want to
>> consider recording some of the other information that is computed in
>> or provided to __new__, like offset.
>>
>> --
>> Robert Kern
>>
>> "I have come to believe that the whole world is an enigma, a harmless
>> enigma that is made terrible by our own mad attempt to interpret it as
>> though it had an underlying truth."
>>  -- Umberto Eco
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
> copying what i asked in the ticket:
> where should i write the docs? in the file itself or through the doc
> editor? also re path, since it can be a file-like, that would have to
> be something like:
>
> if isinstance(filename, basestring):
>    filename = os.path.abspath(filename)
> self.filename = filename
>
> ok with that?

In the case of file object, we should grab the filename from it.
Whether the filename argument to the constructor was a file name or a
file object, self.filename should always be the file name, IMO.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list