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

collections.abc.ByteString is not equivalent to typing.ByteString #102092

Closed
Labels
docsDocumentation in the Doc dirtopic-typingtype-bugAn unexpected behavior, bug, or error
@hauntsaninja

Description

@hauntsaninja

There are two related, but different strands of conversation here:

However, there is an additional issue!collections.abc.ByteString is not an accurate replacement fortyping.ByteString!collections.abc.ByteString only registersbytes andbytearray, whereastyping.ByteString is documented as also representing a memoryview. This is an issue regardless of the above two related conversations.

For this issue we could:

  • Move the documentation oftyping.ByteString out from under the "Corresponding to collections in collections.abc" section to the "Other concrete types" section
  • Remove all mention ofcollections.abc.ByteString from typing.rst
  • Keep the mention oftyping.ByteString as being deprecated, but change the reason. ByteString is not a generic type andcollections.abc.ByteString is not a semantic replacement for it as above, so the current reason is wrong on two counts
  • Definetyping.ByteString in typeshed as a simple Union, and not the Sequence[int] thing it is right now.
  • Definetyping.ByteString as a Union in typing.py instead of the generic alias it is now(?)

Here's how this relates to the other two strands of conversation:

  • We should also remove the note about the bytes shorthand from the docs
  • We should deprecate bothtyping.ByteString andcollections.abc.ByteString. I'm fine with going slow on the removal oftyping.ByteString, since once it's a union in typeshed it's not causing much harm. But ideally we can removecollections.abc.ByteString in 3.14, since its isinstance behaviour is not what you want.

cc@JelleZijlstra

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirtopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp