Skip to content

warnings.WarningMessage should be documented #138128

@calestyo

Description

@calestyo

Hey.

It’s been discussed already previously (but AFAICS with no real outcome)...

IMO warnings.WarningMessage should be documented, at least those parts which one can consider public API.

For example, when using warnings.catch_warnings with a custom warning class (e.g. derived from UserWarning and with some custom attributes attached), one may want to actually access those custom attributes from the caught warnings.

One can, it seems, as that warning object seems to be in the .message attribute of the warnings.WarningMessage... which may be a bit tricky to spot (message is usually thought of as some string, and thus as the first of the args of UserWarning).

I guess documenting the other attributes like category, etc. pp. wouldn’t harm either. :-)

Thanks,
Chris.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirpendingThe issue will be closed if no feedback is provided

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions