Merged revisions 73190,73213,73257-73258,73260,73275,73294 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73190 | georg.brandl | 2009-06-04 01:23:45 +0200 (Do, 04 Jun 2009) | 2 lines Avoid PendingDeprecationWarnings emitted by deprecated unittest methods. ........ r73213 | georg.brandl | 2009-06-04 12:15:57 +0200 (Do, 04 Jun 2009) | 1 line #5967: note that the C slicing APIs do not support negative indices. ........ r73257 | georg.brandl | 2009-06-06 19:50:05 +0200 (Sa, 06 Jun 2009) | 1 line #6211: elaborate a bit on ways to call the function. ........ r73258 | georg.brandl | 2009-06-06 19:51:31 +0200 (Sa, 06 Jun 2009) | 1 line #6204: use a real reference instead of "see later". ........ r73260 | georg.brandl | 2009-06-06 20:21:58 +0200 (Sa, 06 Jun 2009) | 1 line #6224: s/JPython/Jython/, and remove one link to a module nine years old. ........ r73275 | georg.brandl | 2009-06-07 22:37:52 +0200 (So, 07 Jun 2009) | 1 line Add Ezio. ........ r73294 | georg.brandl | 2009-06-08 15:34:52 +0200 (Mo, 08 Jun 2009) | 1 line #6194: O_SHLOCK/O_EXLOCK are not really more platform independent than lockf(). ........
This commit is contained in:
parent
8d8f197c9c
commit
c6c3178942
|
@ -112,9 +112,10 @@ List Objects
|
||||||
|
|
||||||
.. cfunction:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high)
|
.. cfunction:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high)
|
||||||
|
|
||||||
Return a list of the objects in *list* containing the objects *between*
|
Return a list of the objects in *list* containing the objects *between* *low*
|
||||||
*low* and *high*. Return *NULL* and set an exception if unsuccessful.
|
and *high*. Return *NULL* and set an exception if unsuccessful. Analogous
|
||||||
Analogous to ``list[low:high]``.
|
to ``list[low:high]``. Negative indices, as when slicing from Python, are not
|
||||||
|
supported.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist)
|
.. cfunction:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist)
|
||||||
|
@ -122,7 +123,8 @@ List Objects
|
||||||
Set the slice of *list* between *low* and *high* to the contents of
|
Set the slice of *list* between *low* and *high* to the contents of
|
||||||
*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may
|
*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may
|
||||||
be *NULL*, indicating the assignment of an empty list (slice deletion).
|
be *NULL*, indicating the assignment of an empty list (slice deletion).
|
||||||
Return ``0`` on success, ``-1`` on failure.
|
Return ``0`` on success, ``-1`` on failure. Negative indices, as when
|
||||||
|
slicing from Python, are not supported.
|
||||||
|
|
||||||
|
|
||||||
.. cfunction:: int PyList_Sort(PyObject *list)
|
.. cfunction:: int PyList_Sort(PyObject *list)
|
||||||
|
|
|
@ -145,7 +145,6 @@ lay-out for the *lockdata* variable is system dependent --- therefore using the
|
||||||
|
|
||||||
Module :mod:`os`
|
Module :mod:`os`
|
||||||
If the locking flags :const:`O_SHLOCK` and :const:`O_EXLOCK` are present
|
If the locking flags :const:`O_SHLOCK` and :const:`O_EXLOCK` are present
|
||||||
in the :mod:`os` module, the :func:`os.open` function provides a more
|
in the :mod:`os` module (on BSD only), the :func:`os.open` function
|
||||||
platform-independent alternative to the :func:`lockf` and :func:`flock`
|
provides an alternative to the :func:`lockf` and :func:`flock` functions.
|
||||||
functions.
|
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ Java Platform
|
||||||
|
|
||||||
.. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','',''))
|
.. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','',''))
|
||||||
|
|
||||||
Version interface for JPython.
|
Version interface for Jython.
|
||||||
|
|
||||||
Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a
|
Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a
|
||||||
tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple
|
tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple
|
||||||
|
|
|
@ -23,9 +23,6 @@ is maintained at ActiveState.)
|
||||||
`Tkinter reference: a GUI for Python <http://infohost.nmt.edu/tcc/help/pubs/lang.html>`_
|
`Tkinter reference: a GUI for Python <http://infohost.nmt.edu/tcc/help/pubs/lang.html>`_
|
||||||
On-line reference material.
|
On-line reference material.
|
||||||
|
|
||||||
`Tkinter for JPython <http://jtkinter.sourceforge.net>`_
|
|
||||||
The Jython interface to Tkinter.
|
|
||||||
|
|
||||||
`Python and Tkinter Programming <http://www.amazon.com/exec/obidos/ASIN/1884777813>`_
|
`Python and Tkinter Programming <http://www.amazon.com/exec/obidos/ASIN/1884777813>`_
|
||||||
The book by John Grayson (ISBN 1-884777-81-3).
|
The book by John Grayson (ISBN 1-884777-81-3).
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,7 @@ This example, as usual, demonstrates some new Python features:
|
||||||
and ``methodname`` is the name of a method that is defined by the object's type.
|
and ``methodname`` is the name of a method that is defined by the object's type.
|
||||||
Different types define different methods. Methods of different types may have
|
Different types define different methods. Methods of different types may have
|
||||||
the same name without causing ambiguity. (It is possible to define your own
|
the same name without causing ambiguity. (It is possible to define your own
|
||||||
object types and methods, using *classes*, as discussed later in this tutorial.)
|
object types and methods, using *classes*, see :ref:`tut-classes`)
|
||||||
The method :meth:`append` shown in the example is defined for list objects; it
|
The method :meth:`append` shown in the example is defined for list objects; it
|
||||||
adds a new element at the end of the list. In this example it is equivalent to
|
adds a new element at the end of the list. In this example it is equivalent to
|
||||||
``result = result + [b]``, but more efficient.
|
``result = result + [b]``, but more efficient.
|
||||||
|
@ -344,15 +344,23 @@ defined to allow. For example::
|
||||||
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
|
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
|
||||||
while True:
|
while True:
|
||||||
ok = input(prompt)
|
ok = input(prompt)
|
||||||
if ok in ('y', 'ye', 'yes'): return True
|
if ok in ('y', 'ye', 'yes'):
|
||||||
if ok in ('n', 'no', 'nop', 'nope'): return False
|
return True
|
||||||
|
if ok in ('n', 'no', 'nop', 'nope'):
|
||||||
|
return False
|
||||||
retries = retries - 1
|
retries = retries - 1
|
||||||
if retries < 0:
|
if retries < 0:
|
||||||
raise IOError('refusenik user')
|
raise IOError('refusenik user')
|
||||||
print(complaint)
|
print(complaint)
|
||||||
|
|
||||||
This function can be called either like this: ``ask_ok('Do you really want to
|
This function can be called in several ways:
|
||||||
quit?')`` or like this: ``ask_ok('OK to overwrite the file?', 2)``.
|
|
||||||
|
* giving only the mandatory argument:
|
||||||
|
``ask_ok('Do you really want to quit?')``
|
||||||
|
* giving one of the optional arguments:
|
||||||
|
``ask_ok('OK to overwrite the file?', 2)``
|
||||||
|
* or even giving all arguments:
|
||||||
|
``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')``
|
||||||
|
|
||||||
This example also introduces the :keyword:`in` keyword. This tests whether or
|
This example also introduces the :keyword:`in` keyword. This tests whether or
|
||||||
not a sequence contains a certain value.
|
not a sequence contains a certain value.
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ExceptionClassTests(unittest.TestCase):
|
||||||
|
|
||||||
def verify_instance_interface(self, ins):
|
def verify_instance_interface(self, ins):
|
||||||
for attr in ("args", "__str__", "__repr__"):
|
for attr in ("args", "__str__", "__repr__"):
|
||||||
self.failUnless(hasattr(ins, attr),
|
self.assertTrue(hasattr(ins, attr),
|
||||||
"%s missing %s attribute" %
|
"%s missing %s attribute" %
|
||||||
(ins.__class__.__name__, attr))
|
(ins.__class__.__name__, attr))
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class ExceptionClassTests(unittest.TestCase):
|
||||||
|
|
||||||
def interface_test_driver(self, results):
|
def interface_test_driver(self, results):
|
||||||
for test_name, (given, expected) in zip(self.interface_tests, results):
|
for test_name, (given, expected) in zip(self.interface_tests, results):
|
||||||
self.failUnlessEqual(given, expected, "%s: %s != %s" % (test_name,
|
self.assertEqual(given, expected, "%s: %s != %s" % (test_name,
|
||||||
given, expected))
|
given, expected))
|
||||||
|
|
||||||
def test_interface_single_arg(self):
|
def test_interface_single_arg(self):
|
||||||
|
|
|
@ -17,6 +17,9 @@ the format to accommodate documentation needs as they arise.
|
||||||
Permissions History
|
Permissions History
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
- Ezio Melotti was given SVN access on June 7 2009 by GFB, for work on and
|
||||||
|
fixes to the documentation.
|
||||||
|
|
||||||
- Paul Kippes was given commit privileges at PyCon 2009 by BAC to work on 3to2.
|
- Paul Kippes was given commit privileges at PyCon 2009 by BAC to work on 3to2.
|
||||||
|
|
||||||
- Ron DuPlain was given commit privileges at PyCon 2009 by BAC to work on 3to2.
|
- Ron DuPlain was given commit privileges at PyCon 2009 by BAC to work on 3to2.
|
||||||
|
|
|
@ -6830,7 +6830,7 @@ unicode_center(PyUnicodeObject *self, PyObject *args)
|
||||||
|
|
||||||
/* This code should go into some future Unicode collation support
|
/* This code should go into some future Unicode collation support
|
||||||
module. The basic comparison should compare ordinals on a naive
|
module. The basic comparison should compare ordinals on a naive
|
||||||
basis (this is what Java does and thus JPython too). */
|
basis (this is what Java does and thus Jython too). */
|
||||||
|
|
||||||
/* speedy UTF-16 code point order comparison */
|
/* speedy UTF-16 code point order comparison */
|
||||||
/* gleaned from: */
|
/* gleaned from: */
|
||||||
|
|
Loading…
Reference in New Issue