7 comments on “A Problem With Python’s Code Blocks

  1. unrelated: when your posts appear in planetpython.org , the title, which should link to the page in your site, points to planetpython.org, so your page cannot be directly reached. RSS glitch ?

    Like

    • Yeah, they’ve told me about that, but I’ve added my site to my own RSS reader and it works fine there. It’s the built-in WordPress RSS system. I don’t know how to solve it.

      Like

  2. ive never been enamored with the idea that loop constructs should have scope local to the loop.

    if you want local scope, use objects or functions, or use a language perverse enough to do that. scope is enough trouble as it is, but with functions or objects at least theres an upside. maybe use c++ or some “pure” language that is 10 times more tedious to use than a language for mortals.

    Like

    • Just to be sure you know what I mean, the only variable I feel needs to stay only within the loop’s scope is i in for i in iterable.
      I don’t care a TON about the loop’s case, since loops aren’t built around the idea of creating some sort of variable scope, like Python’s with blocks, but it’s still weird to be able to access that variable after the loop since you get access to the last value of the iterable, despite that not having any significant meaning.

      Liked by 1 person

  3. Not always the goal of an for loop is do do something with each element, sometimes you want to search/find an element and using them afterwards.

    Like

Leave a comment