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

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

Expand Messages
  • Maxim Kim
    Mar 2, 2009
      Hi,
      the following vimscript gives me an error on plain vim72 with no
      patches applied:

      let mdict = {"name": "vimwiki", "data":[]}
      for [key, value] in items(mdict)
      " echo key value
      endfor

      E706: Variable type mismatch for: value.

      :h E706 gives some explanation -- it looks like there is "change the
      type of a variable" from string to a list.

      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.
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 3 messages in this topic