Skip to content

str.tobytes() and bytes/bytearray.tostr() #47502

Closed

Description

@mark-summerfield
BPO 3252
Nosy @malemburg, @amauryfa, @mark-summerfield, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2008-07-01.17:17:52.504>
created_at = <Date 2008-07-01.15:39:11.897>
labels = ['interpreter-core', 'type-feature']
title = 'str.tobytes() and bytes/bytearray.tostr()'
updated_at = <Date 2008-07-01.17:17:52.480>
user = 'https://github.com/mark-summerfield'

bugs.python.org fields:

activity = <Date 2008-07-01.17:17:52.480>
actor = 'lemburg'
assignee = 'none'
closed = True
closed_date = <Date 2008-07-01.17:17:52.504>
closer = 'lemburg'
components = ['Interpreter Core']
creation = <Date 2008-07-01.15:39:11.897>
creator = 'mark'
dependencies = []
files = []
hgrepos = []
issue_num = 3252
keywords = []
message_count = 4.0
messages = ['69047', '69048', '69049', '69052']
nosy_count = 4.0
nosy_names = ['lemburg', 'amaury.forgeotdarc', 'mark', 'benjamin.peterson']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue3252'
versions = ['Python 3.0']

Activity

  1. mark-summerfield commented on Jul 1, 2008

    mark-summerfieldmannequin
    MannequinAuthor

    I know it is almost certainly too late, but I think a lot of people will
    be confused by str.decode() and bytes.encode() (or was that the other
    way around)?

    Calling the methods str.tobytes() and bytes.tostr() (or nicer,
    str.to_bytes() and bytes.to_str()) would be hard to confuse and IMO will
    lead to fewer bug reports and complaints once Python 3.0 final comes out.

    And there is a kind of precedent in that threading.isDaemon() became
    threading.is_daemon() between 30a5 and 30b1.

  2. added
    interpreter-core
    type-feature
    on Jul 1, 2008
  3. benjaminp commented on Jul 1, 2008

    @benjaminp
    Contributor

    -1
    encoding and decoding is generally accepted terminology. Besides then we
    would be binding ourselves to returning bytes or a str; that's not
    necessarily guaranteed.

    Anyway, I think this hardly has a chance in the place we are (between
    betas).

  4. amauryfa commented on Jul 1, 2008

    @amauryfa
    Contributor

    encoding and decoding is generally accepted terminology

    Yes, but I personally always pause a couple of seconds each time I have
    to write "encode" or "decode".
    Following Mark's idea, I think I will mentally use "en-bytes" and
    "de-bytes" as a mnemonic...

  5. malemburg commented on Jul 1, 2008

    @malemburg
    Member

    There's nothing new to .encode() and .decode(). They have existed since
    Python 1.6.

  6. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-coretype-feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions