Giter Club home page Giter Club logo

Comments (3)

alandonovan avatar alandonovan commented on May 21, 2024 1

The doc comment is out of date. The spec was changed relatively recently to makes strings not-iterable, because more often than not, iterating over a string is a mistake. (The usual symptom is that one means to iterate over the list ["foo"] but instead iterates over "foo", yielding the values "f", "o", "o". Because the elements of the iteration have the same type as the sequence as a whole, often the mistake goes unnoticed. The two staff at Google with single-letter userids receive a lot of unintended e-mail sent by errant Python programs.)

Instead of string being iterable, four methods were added to string that return iterable values. This approach also makes the intention more obvious as to whether you're iterating over string elements (bytes) or Unicode code points, and whether numeric values or substrings are desired.

from skylark.

imjasonh avatar imjasonh commented on May 21, 2024

Great, I was hoping this wouldn't go down the path Python chose, and was nervous when I read the doc string. :)

from skylark.

alandonovan avatar alandonovan commented on May 21, 2024

Re-opening as a documentation issue.

from skylark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.