On 10 April 2015, Alexey Muranov <alexey.mura...@gmail.com> wrote: > On 10 avr. 2015, at 20:51, LCD 47 <lcd...@gmail.com> wrote: > > > On 10 April 2015, Alexey <alexey.mura...@gmail.com> wrote: > >> The documentation for "dict" functions shows the following example: > >> > >> let mydict = {'data': [0, 1, 2, 3]} > >> function mydict.len() dict > >> return len(self.data) > >> endfunction > >> echo mydict.len() > > > > The current example looks different: > > > > :function Mylen() dict > > : return len(self.data) > > :endfunction > > :let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")} > > :echo mydict.len() > > Please check :h anonymous-function
Yes, but my point remains: functions without 'dict' should be, err, selfless. ;) So your question should be, why does 'self' get recognized in this construct, when the manual explicitly states it shouldn't be: let mydict = {'data': [0, 1, 2, 3]} function mydict.len() return len(self.data) endfunction /lcd -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.