Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6244253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:17:40+00:00 2026-05-24T12:17:40+00:00

This is a section from Dive Into Python 3 regarding strings: In Python 3,

  • 0

This is a section from Dive Into Python 3 regarding strings:

In Python 3, all strings are sequences of Unicode characters. There is no such thing as a Python string encoded in utf-8, or a Python string encoded as CP-1252. “Is this string utf-8?” is an invalid question. utf-8 is a way of encoding characters as a sequence of bytes. If you want to take a string and turn it into a sequence of bytes in a particular character encoding, Python 3 can help you with that. If you want to take a sequence of bytes and turn it into a string, Python 3 can help you with that too. Bytes are not characters; bytes are bytes. Characters are an abstraction. A string is a sequence of those abstractions.

Earlier today I used the hashlib module and read the help text for md5 that says:

Return a new MD5 hash object; optionally initialized with a string.

Well, it doesn’t accept a string – it accepts a bytes object.

Maybe I’m reading too much into this, but wouldn’t it make more sense if the help text stated a bytes should be used instead? Or are people using the same name for strings and bytes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:17:41+00:00Added an answer on May 24, 2026 at 12:17 pm

    In Python 2 and 3, str was used both for strings of characters as well as bytes. In Fact, until Python 2.6, there wasn’t even a bytes type (and in 2.6 and 2.7, bytes is str).

    The mentioned inconsistencies in the hashlib documentation are an artifact of this history.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a section from my web.config: <authentication mode=Forms> <forms name=.MyCookie loginUrl=~/Registration.aspx protection=All timeout=30
from Dive into HTML5: Cache Manifest: Fallback section CACHE MANIFEST FALLBACK: / /offline.html NETWORK:
This is the code section from inno setup.My intention is to make two Checkbox
This is what I have typed in the footer message section from the site
In particular from this web.config: <configuration> <configSections> <section name=RStrace type=Microsoft.ReportingServices.Diagnostics.RSTraceSectionHandler,Microsoft.ReportingServices.Diagnostics /> </configSections> <system.diagnostics> <switches>
This is the section from the CLLocationManager documentation describing the app behavior with startMonitoringSignificantLocationChanges
I use drop-down selector to load matching section from an external file into the
This is a section from Core Java 8th edition Page 757 CAUTION: public void
This is a bit of code from a section of my app where I
In this section of a function (.NET 2.0): public void AttachInput<T>(T input) where T

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.