# HG changeset patch
# User ZyX <[email protected]>
# Date 1369572430 -14400
# Node ID a9cd5f321ccca75a8339146091ba461fae168b34
# Parent cfff09398b373d2dbc3fa24fe0d2b20f4ce83d5d
Update documentation
diff -r cfff09398b37 -r a9cd5f321ccc runtime/doc/if_pyth.txt
--- a/runtime/doc/if_pyth.txt Sun May 26 15:48:35 2013 +0400
+++ b/runtime/doc/if_pyth.txt Sun May 26 16:47:10 2013 +0400
@@ -480,17 +480,36 @@
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 @@
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 @@
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 @@
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
--
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
*** /tmp/extdiff.Cnhzpx/vim.cfff09398b37/runtime/doc/if_pyth.txt 2013-05-26 16:48:41.849815099 +0400
--- vim.a9cd5f321ccc/runtime/doc/if_pyth.txt 2013-05-26 16:48:41.853815047 +0400
***************
*** 480,496 ****
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
vim.VAR_SCOPE Other scope dictionary,
see |internal-variables|
! Methods:
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)
Adds keys to dictionary.
Examples: >
! py d = vim.bindeval('{}')
d['a'] = 'b' # Item assignment
print d['a'] # getting item
d.update({'c': 'd'}) # .update(dictionary)
--- 480,515 ----
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
vim.VAR_SCOPE Other scope dictionary,
see |internal-variables|
! 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)
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: >
! d = vim.Dictionary(food="bar") # Constructor
d['a'] = 'b' # Item assignment
print d['a'] # getting item
d.update({'c': 'd'}) # .update(dictionary)
***************
*** 501,506 ****
--- 520,526 ----
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,517 ****
following methods:
Method Description ~
extend(item) Add items to the list.
Examples: >
! l = vim.bindeval('[]')
l.extend(['abc', 'def']) # .extend() method
print l[1:] # slicing
l[:0] = ['ghi', 'jkl'] # slice assignment
--- 530,543 ----
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.List("abc") # Constructor, result: ['a', 'b', 'c']
l.extend(['abc', 'def']) # .extend() method
print l[1:] # slicing
l[:0] = ['ghi', 'jkl'] # slice assignment
***************
*** 519,531 ****
l[0] = 'mno' # assignment
for i in l: # iteration
print isinstance(l, vim.List) # True
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|.
Examples: >
! f = vim.bindeval('function("tr")')
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
vim.command('''
function DictFun() dict
--- 545,560 ----
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|. You can also use `vim.Function(name)` constructor,
! it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`.
!
Examples: >
! f = vim.Function('tr') # Constructor
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
vim.command('''
function DictFun() dict