Skip to content

The docstring of bytes() and bytearray() should show source and show the default values for source, encoding and errors and should say bytes-like object #137114

@hyperkai

Description

@hyperkai

The docstrings of bytes() and bytearray() show the wrong parameter object and don't show the default values for source, encoding and errors and does say bytes_or_buffer as shown below:

print(help(bytes))
# class bytes(object)
#  |  bytes(iterable_of_ints) -> bytes
#  |  bytes(string, encoding[, errors]) -> bytes
#  |  bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
#  |  bytes(int) -> bytes object of size given by the parameter initialized with null bytes
#  |  bytes() -> empty bytes object
print(help(bytearray))
# class bytearray(object)
#  |  bytearray(iterable_of_ints) -> bytearray
#  |  bytearray(string, encoding[, errors]) -> bytearray
#  |  bytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer
#  |  bytearray(int) -> bytes array of size given by the parameter initialized with null bytes
#  |  bytearray() -> empty bytes array

So, the docstring of bytes() and bytearray() should show source and show the default values for source, encoding and errors and should say bytes-like object as shown below:

print(help(bytes))
# class bytes(source=b'')
#  |  bytes(iterable_of_ints) -> bytes
#  |  bytes(source, encoding='utf-8', errors='strict') -> bytes
#  |  bytes(string, encoding[, errors]) -> bytes
#  |  bytes(bytes-like object) -> immutable copy of bytes-like object
#  |  bytes(int) -> bytes object of size given by the parameter initialized with null bytes
#  |  bytes() -> empty bytes object
print(help(bytearray))
# class bytearray(source=b'')
#  |  bytearray(iterable_of_ints) -> bytearray
#  |  bytearray(source, encoding='utf-8', errors='strict') -> bytearray
#  |  bytearray(string, encoding[, errors]) -> bytearray
#  |  bytearray(bytes-like object) -> mutable copy of bytes-like object
#  |  bytearray(int) -> bytes array of size given by the parameter initialized with null bytes
#  |  bytearray() -> empty bytes array

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dir

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions