File-like objects name attribute.
noah at noah.org
Sun Jan 5 19:14:58 CET 2003
I'm creating a file-like object. According to the current doc page:
If the file object was created using open(), the name of the file.
Otherwise, some string that indicates the source of the file object,
of the form "<...>". This is a read-only attribute and may not
be present on all file-like objects.
What does the form "<...>" mean? Does this mean I should include < > around
the name for my file-like object? For my purposes, I don't much care.
I just want to be complete.
In my case, I am implementing a pure Python expect module.
My file-like class spawns a child process and lets you talk to it like a file.
I want to have name represent the command and arguments of the child process
that was spawned. For exmaple, which of the following is more correct:
name = "/bin/ls -la /etc"
name = "</bin/ls -la /etc>"
More information about the Python-list