diff runtime/doc/if_pyth.txt @ 8889:8755d57debaa v7.4.1731

commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 14 15:56:09 2016 +0200 patch 7.4.1731 Problem: Python: turns partial into simple funcref. Solution: Use partials like partials. (Nikolai Pavlov, closes https://github.com/vim/vim/issues/734)
author Christian Brabandt <cb@256bit.org>
date Thu, 14 Apr 2016 16:00:06 +0200
parents ed7251c3e2d3
children 0bdeaf7092bc
line wrap: on
line diff
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -653,10 +653,25 @@ vim.List object					*python-List*
         class List(vim.List):		# Subclassing
 
 vim.Function object				*python-Function*
-    Function-like object, acting like vim |Funcref| object. Supports `.name` 
-    attribute and is callable. Accepts special keyword argument `self`, see 
-    |Dictionary-function|. You can also use `vim.Function(name)` constructor, 
-    it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`.
+    Function-like object, acting like vim |Funcref| object. Accepts special 
+    keyword argument `self`, see |Dictionary-function|. You can also use 
+    `vim.Function(name)` constructor, it is the same as 
+    `vim.bindeval('function(%s)'%json.dumps(name))`.
+
+    Attributes (read-only):
+        Attribute  Description ~
+        name       Function name.
+        args       `None` or a |python-List| object with arguments.  Note that 
+                   this is a copy of the arguments list, constructed each time 
+                   you request this attribute. Modifications made to the list 
+                   will be ignored (but not to the containers inside argument 
+                   list: this is like |copy()| and not |deepcopy()|).
+        self       `None` or a |python-Dictionary| object with self 
+                   dictionary. Note that explicit `self` keyword used when 
+                   calling resulting object overrides this attribute.
+
+    Constructor additionally accepts `args` and `self` keywords.  If any of 
+    them is given then it constructs a partial, see |function()|.
 
     Examples: >
         f = vim.Function('tr')			# Constructor
@@ -670,6 +685,11 @@ vim.Function object				*python-Function*
         print f(self={})			# Like call('DictFun', [], {})
         print isinstance(f, vim.Function)	# True
 
+        p = vim.Function('DictFun', self={})
+        print f()
+        p = vim.Function('tr', args=['abc', 'a'])
+        print f('b')
+
 ==============================================================================
 8. pyeval() and py3eval() Vim functions			*python-pyeval*