How to waste computer memory?

Marko Rauhamaa marko at pacujo.net
Sat Mar 19 05:40:33 EDT 2016


Chris Angelico <rosuav at gmail.com>:

> On Sat, Mar 19, 2016 at 7:22 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> Not all files have pathnames. Those that do have numerous pathnames. You
>> can't tell by looking at a file what pathnames, if any, it might have.
>> You need an exhaustive, recursive search of the file system for the
>> reverse mapping.
>>
>> If you execute the commands:
>>
>>    echo hello >hello
>>    rm hello
>>
>> You don't know for sure if the file you removed was the file you created
>> on the previous line.
>
> Not all objects in Python have names bound to them. Those that do may
> have multiple. You can't tell, by looking at an object, what pathnames
> it has. You need an exhaustive, recursive search of all namespaces for
> the reverse mapping.
>
> If you execute the commands:
>
> hello = re.compile("[Hh][Ee][Ll][Ll][Oo]")
> hello.match(msg)
>
> you don't know for sure if the object you called a method on was the
> one you created on the previous line.
>
> So are object names not part of Python?

What are you talking about, Chris?

Point is, UNIX file systems don't provide for inode handles. You have
pathnames and file descriptors, but you'd need something between the
two. The omission plagues UNIX application programmers and is the cause
of numerous bugs -- even when the programmers are not aware of the
danger.

Objects in Python have trivial references: just assign the object to a
variable.


Marko



More information about the Python-list mailing list