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

Re: for [k,v] in items(dict): Bug? Design?

Expand Messages
  • Marc Weber
    ... I don t like this vim behaviour either. However you can work around it: let lst = [ hello , []] for value in lst do stuff unlet value endfor Marc Weber
    Message 1 of 3 , Mar 2, 2009
    • 0 Attachment
      On Mon, Mar 02, 2009 at 07:21:09AM -0800, Maxim Kim wrote:
      > [...]
      > E706: Variable type mismatch for: value.
      >
      > So, it looks like for loop cannot iterate over composite data.
      > Just tried:
      >
      > let lst = ["hello", []]
      > for value in lst
      > endfor
      >
      > Gives me the same error.
      > I'd expect it to do :unlet key, :unlet value before each iteration.

      I don't like this vim behaviour either. However you can work around it:

      let lst = ["hello", []]
      for value in lst
      " do stuff
      unlet value
      endfor

      Marc Weber

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.