Basic file objects have the name
Do all other file types (like GzipFile) in the standard library have this attribute?
No, for example StringIO is a file-like object with no attribute name
. Most of the objects associated with the actual file have it, but this is not guaranteed.