Loading ...
Sorry, an error occurred while loading the content.

69Re: [python-iter] Colon syntax: We barely knew thee...

Expand Messages
  • Ka-Ping Yee
    Mar 3, 2001
    • 0 Attachment
      On Sat, 3 Mar 2001, Clark C. Evans wrote:
      > Another question, have people considerd "tuple" syntax?
      > I actually find this more readable than colon syntax.
      >
      > for (key,_) in dict:
      > for (_,value) in dict:
      > for (key,value) in dict:

      Binding to tuples already has a well-defined meaning.

      blah = [(1, 2), (3, 4), (5, 6)]
      for (a, b) in blah:

      makes perfect sense, analogous to (a, b) = (1, 2) in Python.

      Similarly --

      blah = {1: 2, 3: 4, 5: 6}
      for key:value in blah:

      It wouldn't make sense (even aside from the compatibility issue!)
      to talk about tuples in a context where there aren't any.

      Hmm, this has been explained before. Perhaps i should add some
      stuff to the Rationale section of the PEP recounting these common
      suggestions/objections and their rebuttals.


      -- ?!ng

      "The biggest cause of trouble in the world today is that the stupid people
      are so sure about things and the intelligent folk are so full of doubts."
      -- Bertrand Russell
    • Show all 27 messages in this topic