comparison runtime/doc/if_pyth.txt @ 9119:39cc63e8df7c v7.4.1843

commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252 Author: Bram Moolenaar <Bram@vim.org> Date: Wed May 25 20:39:09 2016 +0200 patch 7.4.1843 Problem: Tests involving Python are flaky. Solution: Set the pt_auto field. Add tests. (Nikolai Pavlov)
author Christian Brabandt <cb@256bit.org>
date Wed, 25 May 2016 20:45:06 +0200
parents 0bdeaf7092bc
children b11ceef7116e
comparison
equal deleted inserted replaced
9118:c35c9121c72b 9119:39cc63e8df7c
657 keyword argument `self`, see |Dictionary-function|. You can also use 657 keyword argument `self`, see |Dictionary-function|. You can also use
658 `vim.Function(name)` constructor, it is the same as 658 `vim.Function(name)` constructor, it is the same as
659 `vim.bindeval('function(%s)'%json.dumps(name))`. 659 `vim.bindeval('function(%s)'%json.dumps(name))`.
660 660
661 Attributes (read-only): 661 Attributes (read-only):
662 Attribute Description ~ 662 Attribute Description ~
663 name Function name. 663 name Function name.
664 args `None` or a |python-List| object with arguments. Note that 664 args `None` or a |python-List| object with arguments. Note
665 this is a copy of the arguments list, constructed each time 665 that this is a copy of the arguments list, constructed
666 you request this attribute. Modifications made to the list 666 each time you request this attribute. Modifications made
667 will be ignored (but not to the containers inside argument 667 to the list will be ignored (but not to the containers
668 list: this is like |copy()| and not |deepcopy()|). 668 inside argument list: this is like |copy()| and not
669 self `None` or a |python-Dictionary| object with self 669 |deepcopy()|).
670 dictionary. Note that explicit `self` keyword used when 670 self `None` or a |python-Dictionary| object with self
671 calling resulting object overrides this attribute. 671 dictionary. Note that explicit `self` keyword used when
672 672 calling resulting object overrides this attribute.
673 Constructor additionally accepts `args` and `self` keywords. If any of 673 auto_rebind Boolean. True if partial created from this Python object
674 them is given then it constructs a partial, see |function()|. 674 and stored in the VimL dictionary should be automatically
675 rebound to the dictionary it is stored in when this
676 dictionary is indexed. Exposes Vim internal difference
677 between `dict.func` (auto_rebind=True) and
678 `function(dict.func,dict)` (auto_rebind=False). This
679 attribute makes no sense if `self` attribute is `None`.
680
681 Constructor additionally accepts `args`, `self` and `auto_rebind`
682 keywords. If `args` and/or `self` argument is given then it constructs
683 a partial, see |function()|. `auto_rebind` is only used when `self`
684 argument is given, otherwise it is assumed to be `True` regardless of
685 whether it was given or not. If `self` is given then it defaults to
686 `False`.
675 687
676 Examples: > 688 Examples: >
677 f = vim.Function('tr') # Constructor 689 f = vim.Function('tr') # Constructor
678 print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b') 690 print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
679 vim.command(''' 691 vim.command('''