File-like objects name attribute.
Noah
noah at noah.org
Sun Jan 5 13:14:58 EST 2003
I'm creating a file-like object. According to the current doc page:
http://www.python.org/doc/current/lib/bltin-file-objects.html#l2h-175
name
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"
or
name = "</bin/ls -la /etc>"
Yours,
Noah
More information about the Python-list
mailing list