Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document the fact thatshutil.Error is a subclass ofOSError #141045

Open
Labels
docsDocumentation in the Doc direasy
@ShaiAvr

Description

@ShaiAvr

Documentation

When I looked at the docs of theshutil module, I noticed that it doesn't mention thatshutil.Error is a subclass ofOSError. runningshutil.Error.mro() reveals that indeedshutil.Error subclassesOSError and it can also be seen in thecode. I think it would be nice to document this fact, so I know that if I do multiple operations which could raise other subclasses ofOSError likeshutil.copy, then I can use:

try:    ...# Use shutil.copytree which raises shutil.Error and/or shutil.copy/shutil.copy2 which raises OSErrorexceptOSErrorase:    ...# Handle any error that occured.

instead of:

try:    ...except (OSError,shutil.Error)ase:# The docs don't mention that shutil.Error and OSError are related, so I need to catch both of them    ...

If it's intentionally not documented since it's an implementation detail, then I still think the docs should mention that and say that it could change, and users shouldn't rely onshutil.Error being a subclass ofOSError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc direasy

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp