summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-05-30 13:32:30 +0200
committerBram Moolenaar <Bram@vim.org>2013-05-30 13:32:30 +0200
commit305b2fde1343422c3fd0f63e7e461a37789069ce (patch)
treead7d381a74826751c02429203bea537522c7bb37
parent8600e40a6725f3ea9c8b545e68337a08472b781d (diff)
updated for version 7.3.1067v7.3.1067
Problem: Python: documentation lags behind. Solution: Python patch 26. (ZyX)
-rw-r--r--runtime/doc/if_pyth.txt45
-rw-r--r--src/version.c2
2 files changed, 39 insertions, 8 deletions
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt
index 5a0418e8b1..4f23d079d8 100644
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -480,17 +480,36 @@ vim.Dictionary object *python-Dictionary*
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
vim.VAR_SCOPE Other scope dictionary,
see |internal-variables|
- Methods:
+ Methods (note: methods do not support keyword arguments):
Method Description ~
keys() Returns a list with dictionary keys.
values() Returns a list with dictionary values.
items() Returns a list of 2-tuples with dictionary contents.
- update(iterable)
- update(dictionary)
- update(**kwargs)
+ update(iterable), update(dictionary), update(**kwargs)
Adds keys to dictionary.
+ get(key[, default=None])
+ Obtain key from dictionary, returning the default if it is
+ not present.
+ pop(key[, default])
+ Remove specified key from dictionary and return
+ corresponding value. If key is not found and default is
+ given returns the default, otherwise raises KeyError.
+ popitem(key)
+ Remove specified key from dictionary and return a pair
+ with it and the corresponding value. Returned key is a new
+ object.
+ has_key(key)
+ Check whether dictionary contains specified key, similar
+ to `key in dict`.
+
+ __new__(), __new__(iterable), __new__(dictionary), __new__(update)
+ You can use `vim.Dictionary()` to create new vim
+ dictionaries. `d=vim.Dictionary(arg)` is the same as
+ `d=vim.bindeval('{}');d.update(arg)`. Without arguments
+ constructs empty dictionary.
+
Examples: >
- py d = vim.bindeval('{}')
+ d = vim.Dictionary(food="bar") # Constructor
d['a'] = 'b' # Item assignment
print d['a'] # getting item
d.update({'c': 'd'}) # .update(dictionary)
@@ -501,6 +520,7 @@ vim.Dictionary object *python-Dictionary*
for key, val in d.items(): # .items()
print isinstance(d, vim.Dictionary) # True
for key in d: # Iteration over keys
+ class Dict(vim.Dictionary): # Subclassing
<
Note: when iterating over keys you should not modify dictionary.
@@ -510,8 +530,14 @@ vim.List object *python-List*
following methods:
Method Description ~
extend(item) Add items to the list.
+
+ __new__(), __new__(iterable)
+ You can use `vim.List()` to create new vim lists.
+ `l=vim.List(iterable)` is the same as
+ `l=vim.bindeval('[]');l.extend(iterable)`. Without
+ arguments constructs empty list.
Examples: >
- l = vim.bindeval('[]')
+ l = vim.List("abc") # Constructor, result: ['a', 'b', 'c']
l.extend(['abc', 'def']) # .extend() method
print l[1:] # slicing
l[:0] = ['ghi', 'jkl'] # slice assignment
@@ -519,13 +545,16 @@ vim.List object *python-List*
l[0] = 'mno' # assignment
for i in l: # iteration
print isinstance(l, vim.List) # True
+ 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|.
+ |Dictionary-function|. You can also use `vim.Function(name)` constructor,
+ it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`.
+
Examples: >
- f = vim.bindeval('function("tr")')
+ f = vim.Function('tr') # Constructor
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
vim.command('''
function DictFun() dict
diff --git a/src/version.c b/src/version.c
index 3bf1f295e4..173f254f9b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1067,
+/**/
1066,
/**/
1065,