|
Karsten Hopp |
404975 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
404975 |
Subject: Patch 7.3.1067
|
|
Karsten Hopp |
404975 |
Fcc: outbox
|
|
Karsten Hopp |
404975 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
404975 |
Mime-Version: 1.0
|
|
Karsten Hopp |
404975 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
404975 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
404975 |
------------
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
Patch 7.3.1067
|
|
Karsten Hopp |
404975 |
Problem: Python: documentation lags behind.
|
|
Karsten Hopp |
404975 |
Solution: Python patch 26. (ZyX)
|
|
Karsten Hopp |
404975 |
Files: runtime/doc/if_pyth.txt
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
*** ../vim-7.3.1066/runtime/doc/if_pyth.txt 2013-05-30 13:01:14.000000000 +0200
|
|
Karsten Hopp |
404975 |
--- runtime/doc/if_pyth.txt 2013-05-30 13:31:16.000000000 +0200
|
|
Karsten Hopp |
404975 |
***************
|
|
Karsten Hopp |
404975 |
*** 480,496 ****
|
|
Karsten Hopp |
404975 |
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
|
|
Karsten Hopp |
404975 |
vim.VAR_SCOPE Other scope dictionary,
|
|
Karsten Hopp |
404975 |
see |internal-variables|
|
|
Karsten Hopp |
404975 |
! Methods:
|
|
Karsten Hopp |
404975 |
Method Description ~
|
|
Karsten Hopp |
404975 |
keys() Returns a list with dictionary keys.
|
|
Karsten Hopp |
404975 |
values() Returns a list with dictionary values.
|
|
Karsten Hopp |
404975 |
items() Returns a list of 2-tuples with dictionary contents.
|
|
Karsten Hopp |
404975 |
! update(iterable)
|
|
Karsten Hopp |
404975 |
! update(dictionary)
|
|
Karsten Hopp |
404975 |
! update(**kwargs)
|
|
Karsten Hopp |
404975 |
Adds keys to dictionary.
|
|
Karsten Hopp |
404975 |
Examples: >
|
|
Karsten Hopp |
404975 |
! py d = vim.bindeval('{}')
|
|
Karsten Hopp |
404975 |
d['a'] = 'b' # Item assignment
|
|
Karsten Hopp |
404975 |
print d['a'] # getting item
|
|
Karsten Hopp |
404975 |
d.update({'c': 'd'}) # .update(dictionary)
|
|
Karsten Hopp |
404975 |
--- 480,515 ----
|
|
Karsten Hopp |
404975 |
vim.VAR_DEF_SCOPE |g:| or |l:| dictionary
|
|
Karsten Hopp |
404975 |
vim.VAR_SCOPE Other scope dictionary,
|
|
Karsten Hopp |
404975 |
see |internal-variables|
|
|
Karsten Hopp |
404975 |
! Methods (note: methods do not support keyword arguments):
|
|
Karsten Hopp |
404975 |
Method Description ~
|
|
Karsten Hopp |
404975 |
keys() Returns a list with dictionary keys.
|
|
Karsten Hopp |
404975 |
values() Returns a list with dictionary values.
|
|
Karsten Hopp |
404975 |
items() Returns a list of 2-tuples with dictionary contents.
|
|
Karsten Hopp |
404975 |
! update(iterable), update(dictionary), update(**kwargs)
|
|
Karsten Hopp |
404975 |
Adds keys to dictionary.
|
|
Karsten Hopp |
404975 |
+ get(key[, default=None])
|
|
Karsten Hopp |
404975 |
+ Obtain key from dictionary, returning the default if it is
|
|
Karsten Hopp |
404975 |
+ not present.
|
|
Karsten Hopp |
404975 |
+ pop(key[, default])
|
|
Karsten Hopp |
404975 |
+ Remove specified key from dictionary and return
|
|
Karsten Hopp |
404975 |
+ corresponding value. If key is not found and default is
|
|
Karsten Hopp |
404975 |
+ given returns the default, otherwise raises KeyError.
|
|
Karsten Hopp |
404975 |
+ popitem(key)
|
|
Karsten Hopp |
404975 |
+ Remove specified key from dictionary and return a pair
|
|
Karsten Hopp |
404975 |
+ with it and the corresponding value. Returned key is a new
|
|
Karsten Hopp |
404975 |
+ object.
|
|
Karsten Hopp |
404975 |
+ has_key(key)
|
|
Karsten Hopp |
404975 |
+ Check whether dictionary contains specified key, similar
|
|
Karsten Hopp |
404975 |
+ to `key in dict`.
|
|
Karsten Hopp |
404975 |
+
|
|
Karsten Hopp |
404975 |
+ __new__(), __new__(iterable), __new__(dictionary), __new__(update)
|
|
Karsten Hopp |
404975 |
+ You can use `vim.Dictionary()` to create new vim
|
|
Karsten Hopp |
404975 |
+ dictionaries. `d=vim.Dictionary(arg)` is the same as
|
|
Karsten Hopp |
404975 |
+ `d=vim.bindeval('{}');d.update(arg)`. Without arguments
|
|
Karsten Hopp |
404975 |
+ constructs empty dictionary.
|
|
Karsten Hopp |
404975 |
+
|
|
Karsten Hopp |
404975 |
Examples: >
|
|
Karsten Hopp |
404975 |
! d = vim.Dictionary(food="bar") # Constructor
|
|
Karsten Hopp |
404975 |
d['a'] = 'b' # Item assignment
|
|
Karsten Hopp |
404975 |
print d['a'] # getting item
|
|
Karsten Hopp |
404975 |
d.update({'c': 'd'}) # .update(dictionary)
|
|
Karsten Hopp |
404975 |
***************
|
|
Karsten Hopp |
404975 |
*** 501,506 ****
|
|
Karsten Hopp |
404975 |
--- 520,526 ----
|
|
Karsten Hopp |
404975 |
for key, val in d.items(): # .items()
|
|
Karsten Hopp |
404975 |
print isinstance(d, vim.Dictionary) # True
|
|
Karsten Hopp |
404975 |
for key in d: # Iteration over keys
|
|
Karsten Hopp |
404975 |
+ class Dict(vim.Dictionary): # Subclassing
|
|
Karsten Hopp |
404975 |
<
|
|
Karsten Hopp |
404975 |
Note: when iterating over keys you should not modify dictionary.
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
***************
|
|
Karsten Hopp |
404975 |
*** 510,517 ****
|
|
Karsten Hopp |
404975 |
following methods:
|
|
Karsten Hopp |
404975 |
Method Description ~
|
|
Karsten Hopp |
404975 |
extend(item) Add items to the list.
|
|
Karsten Hopp |
404975 |
Examples: >
|
|
Karsten Hopp |
404975 |
! l = vim.bindeval('[]')
|
|
Karsten Hopp |
404975 |
l.extend(['abc', 'def']) # .extend() method
|
|
Karsten Hopp |
404975 |
print l[1:] # slicing
|
|
Karsten Hopp |
404975 |
l[:0] = ['ghi', 'jkl'] # slice assignment
|
|
Karsten Hopp |
404975 |
--- 530,543 ----
|
|
Karsten Hopp |
404975 |
following methods:
|
|
Karsten Hopp |
404975 |
Method Description ~
|
|
Karsten Hopp |
404975 |
extend(item) Add items to the list.
|
|
Karsten Hopp |
404975 |
+
|
|
Karsten Hopp |
404975 |
+ __new__(), __new__(iterable)
|
|
Karsten Hopp |
404975 |
+ You can use `vim.List()` to create new vim lists.
|
|
Karsten Hopp |
404975 |
+ `l=vim.List(iterable)` is the same as
|
|
Karsten Hopp |
404975 |
+ `l=vim.bindeval('[]');l.extend(iterable)`. Without
|
|
Karsten Hopp |
404975 |
+ arguments constructs empty list.
|
|
Karsten Hopp |
404975 |
Examples: >
|
|
Karsten Hopp |
404975 |
! l = vim.List("abc") # Constructor, result: ['a', 'b', 'c']
|
|
Karsten Hopp |
404975 |
l.extend(['abc', 'def']) # .extend() method
|
|
Karsten Hopp |
404975 |
print l[1:] # slicing
|
|
Karsten Hopp |
404975 |
l[:0] = ['ghi', 'jkl'] # slice assignment
|
|
Karsten Hopp |
404975 |
***************
|
|
Karsten Hopp |
404975 |
*** 519,531 ****
|
|
Karsten Hopp |
404975 |
l[0] = 'mno' # assignment
|
|
Karsten Hopp |
404975 |
for i in l: # iteration
|
|
Karsten Hopp |
404975 |
print isinstance(l, vim.List) # True
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
vim.Function object *python-Function*
|
|
Karsten Hopp |
404975 |
Function-like object, acting like vim |Funcref| object. Supports `.name`
|
|
Karsten Hopp |
404975 |
attribute and is callable. Accepts special keyword argument `self`, see
|
|
Karsten Hopp |
404975 |
! |Dictionary-function|.
|
|
Karsten Hopp |
404975 |
Examples: >
|
|
Karsten Hopp |
404975 |
! f = vim.bindeval('function("tr")')
|
|
Karsten Hopp |
404975 |
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
|
|
Karsten Hopp |
404975 |
vim.command('''
|
|
Karsten Hopp |
404975 |
function DictFun() dict
|
|
Karsten Hopp |
404975 |
--- 545,560 ----
|
|
Karsten Hopp |
404975 |
l[0] = 'mno' # assignment
|
|
Karsten Hopp |
404975 |
for i in l: # iteration
|
|
Karsten Hopp |
404975 |
print isinstance(l, vim.List) # True
|
|
Karsten Hopp |
404975 |
+ class List(vim.List): # Subclassing
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
vim.Function object *python-Function*
|
|
Karsten Hopp |
404975 |
Function-like object, acting like vim |Funcref| object. Supports `.name`
|
|
Karsten Hopp |
404975 |
attribute and is callable. Accepts special keyword argument `self`, see
|
|
Karsten Hopp |
404975 |
! |Dictionary-function|. You can also use `vim.Function(name)` constructor,
|
|
Karsten Hopp |
404975 |
! it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`.
|
|
Karsten Hopp |
404975 |
!
|
|
Karsten Hopp |
404975 |
Examples: >
|
|
Karsten Hopp |
404975 |
! f = vim.Function('tr') # Constructor
|
|
Karsten Hopp |
404975 |
print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b')
|
|
Karsten Hopp |
404975 |
vim.command('''
|
|
Karsten Hopp |
404975 |
function DictFun() dict
|
|
Karsten Hopp |
404975 |
*** ../vim-7.3.1066/src/version.c 2013-05-30 13:28:37.000000000 +0200
|
|
Karsten Hopp |
404975 |
--- src/version.c 2013-05-30 13:31:42.000000000 +0200
|
|
Karsten Hopp |
404975 |
***************
|
|
Karsten Hopp |
404975 |
*** 730,731 ****
|
|
Karsten Hopp |
404975 |
--- 730,733 ----
|
|
Karsten Hopp |
404975 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
404975 |
+ /**/
|
|
Karsten Hopp |
404975 |
+ 1067,
|
|
Karsten Hopp |
404975 |
/**/
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
--
|
|
Karsten Hopp |
404975 |
How To Keep A Healthy Level Of Insanity:
|
|
Karsten Hopp |
404975 |
9. As often as possible, skip rather than walk.
|
|
Karsten Hopp |
404975 |
|
|
Karsten Hopp |
404975 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
404975 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
404975 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
404975 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|