home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.1067 < prev    next >
Encoding:
Internet Message Format  |  2013-05-29  |  6.4 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.1067
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.1067
  11. Problem:    Python: documentation lags behind.
  12. Solution:   Python patch 26. (ZyX)
  13. Files:      runtime/doc/if_pyth.txt
  14.  
  15.  
  16. *** ../vim-7.3.1066/runtime/doc/if_pyth.txt    2013-05-30 13:01:14.000000000 +0200
  17. --- runtime/doc/if_pyth.txt    2013-05-30 13:31:16.000000000 +0200
  18. ***************
  19. *** 480,496 ****
  20.                       vim.VAR_DEF_SCOPE  |g:| or |l:| dictionary
  21.                       vim.VAR_SCOPE      Other scope dictionary,
  22.                                          see |internal-variables|
  23. !     Methods:
  24.           Method      Description ~
  25.           keys()      Returns a list with dictionary keys.
  26.           values()    Returns a list with dictionary values.
  27.           items()     Returns a list of 2-tuples with dictionary contents.
  28. !         update(iterable)
  29. !         update(dictionary)
  30. !         update(**kwargs)
  31.                       Adds keys to dictionary.
  32.       Examples: >
  33. !         py d = vim.bindeval('{}')
  34.           d['a'] = 'b'                # Item assignment
  35.           print d['a']                # getting item
  36.           d.update({'c': 'd'})            # .update(dictionary)
  37. --- 480,515 ----
  38.                       vim.VAR_DEF_SCOPE  |g:| or |l:| dictionary
  39.                       vim.VAR_SCOPE      Other scope dictionary,
  40.                                          see |internal-variables|
  41. !     Methods (note: methods do not support keyword arguments):
  42.           Method      Description ~
  43.           keys()      Returns a list with dictionary keys.
  44.           values()    Returns a list with dictionary values.
  45.           items()     Returns a list of 2-tuples with dictionary contents.
  46. !         update(iterable), update(dictionary), update(**kwargs)
  47.                       Adds keys to dictionary.
  48. +         get(key[, default=None])
  49. +                     Obtain key from dictionary, returning the default if it is 
  50. +                     not present.
  51. +         pop(key[, default])
  52. +                     Remove specified key from dictionary and return 
  53. +                     corresponding value. If key is not found and default is 
  54. +                     given returns the default, otherwise raises KeyError.
  55. +         popitem(key)
  56. +                     Remove specified key from dictionary and return a pair 
  57. +                     with it and the corresponding value. Returned key is a new 
  58. +                     object.
  59. +         has_key(key)
  60. +                     Check whether dictionary contains specified key, similar 
  61. +                     to `key in dict`.
  62. +         __new__(), __new__(iterable), __new__(dictionary), __new__(update)
  63. +                     You can use `vim.Dictionary()` to create new vim 
  64. +                     dictionaries. `d=vim.Dictionary(arg)` is the same as 
  65. +                     `d=vim.bindeval('{}');d.update(arg)`. Without arguments 
  66. +                     constructs empty dictionary.
  67.       Examples: >
  68. !         d = vim.Dictionary(food="bar")        # Constructor
  69.           d['a'] = 'b'                # Item assignment
  70.           print d['a']                # getting item
  71.           d.update({'c': 'd'})            # .update(dictionary)
  72. ***************
  73. *** 501,506 ****
  74. --- 520,526 ----
  75.           for key, val in d.items():        # .items()
  76.           print isinstance(d, vim.Dictionary)    # True
  77.           for key in d:                # Iteration over keys
  78. +         class Dict(vim.Dictionary):        # Subclassing
  79.   <
  80.       Note: when iterating over keys you should not modify dictionary.
  81.   
  82. ***************
  83. *** 510,517 ****
  84.       following methods:
  85.           Method          Description ~
  86.           extend(item)    Add items to the list.
  87.       Examples: >
  88. !         l = vim.bindeval('[]')
  89.           l.extend(['abc', 'def'])    # .extend() method
  90.           print l[1:]            # slicing
  91.           l[:0] = ['ghi', 'jkl']        # slice assignment
  92. --- 530,543 ----
  93.       following methods:
  94.           Method          Description ~
  95.           extend(item)    Add items to the list.
  96. +         __new__(), __new__(iterable)
  97. +                         You can use `vim.List()` to create new vim lists. 
  98. +                         `l=vim.List(iterable)` is the same as 
  99. +                         `l=vim.bindeval('[]');l.extend(iterable)`. Without 
  100. +                         arguments constructs empty list.
  101.       Examples: >
  102. !         l = vim.List("abc")        # Constructor, result: ['a', 'b', 'c']
  103.           l.extend(['abc', 'def'])    # .extend() method
  104.           print l[1:]            # slicing
  105.           l[:0] = ['ghi', 'jkl']        # slice assignment
  106. ***************
  107. *** 519,531 ****
  108.           l[0] = 'mno'            # assignment
  109.           for i in l:            # iteration
  110.           print isinstance(l, vim.List)    # True
  111.   
  112.   vim.Function object                *python-Function*
  113.       Function-like object, acting like vim |Funcref| object. Supports `.name` 
  114.       attribute and is callable. Accepts special keyword argument `self`, see 
  115. !     |Dictionary-function|.
  116.       Examples: >
  117. !         f = vim.bindeval('function("tr")')
  118.           print f('abc', 'a', 'b')        # Calls tr('abc', 'a', 'b')
  119.           vim.command('''
  120.               function DictFun() dict
  121. --- 545,560 ----
  122.           l[0] = 'mno'            # assignment
  123.           for i in l:            # iteration
  124.           print isinstance(l, vim.List)    # True
  125. +         class List(vim.List):        # Subclassing
  126.   
  127.   vim.Function object                *python-Function*
  128.       Function-like object, acting like vim |Funcref| object. Supports `.name` 
  129.       attribute and is callable. Accepts special keyword argument `self`, see 
  130. !     |Dictionary-function|. You can also use `vim.Function(name)` constructor, 
  131. !     it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`.
  132.       Examples: >
  133. !         f = vim.Function('tr')            # Constructor
  134.           print f('abc', 'a', 'b')        # Calls tr('abc', 'a', 'b')
  135.           vim.command('''
  136.               function DictFun() dict
  137. *** ../vim-7.3.1066/src/version.c    2013-05-30 13:28:37.000000000 +0200
  138. --- src/version.c    2013-05-30 13:31:42.000000000 +0200
  139. ***************
  140. *** 730,731 ****
  141. --- 730,733 ----
  142.   {   /* Add new patch number below this line */
  143. + /**/
  144. +     1067,
  145.   /**/
  146.  
  147. -- 
  148. How To Keep A Healthy Level Of Insanity:
  149. 9. As often as possible, skip rather than walk.
  150.  
  151.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  152. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  153. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  154.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  155.