summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/collections.rst3
-rw-r--r--Doc/library/itertools.rst11
-rw-r--r--Doc/library/msilib.rst2
-rw-r--r--Doc/library/queue.rst7
-rw-r--r--Doc/library/sched.rst35
-rw-r--r--Doc/library/smtplib.rst26
-rw-r--r--Doc/library/socket.rst2
7 files changed, 79 insertions, 7 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index f1a8fff..cbc9c6b 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -566,6 +566,9 @@ faster versions that bypass error-checking::
def _replace(self, _map=map, **kwds):
return self._make(_map(kwds.get, ('x', 'y'), self))
+The subclasses shown above set ``__slots__`` to an empty tuple. This keeps
+keep memory requirements low by preventing the creation of instance dictionaries.
+
Subclassing is not useful for adding new, stored fields. Instead, simply
create a new named tuple type from the :attr:`_fields` attribute::
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 21f6476..ca2b1ff 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -319,16 +319,19 @@ loops that truncate the stream.
.. function:: starmap(function, iterable)
- Make an iterator that computes the function using arguments tuples obtained from
+ Make an iterator that computes the function using arguments obtained from
the iterable. Used instead of :func:`imap` when argument parameters are already
grouped in tuples from a single iterable (the data has been "pre-zipped"). The
difference between :func:`imap` and :func:`starmap` parallels the distinction
between ``function(a,b)`` and ``function(*c)``. Equivalent to::
def starmap(function, iterable):
- iterable = iter(iterable)
- while True:
- yield function(*next(iterable))
+ for args in iterable:
+ yield function(*args)
+
+ .. versionchanged:: 2.6
+ Previously, :func:`starmap` required the function arguments to be tuples.
+ Now, any iterable is allowed.
.. function:: takewhile(predicate, iterable)
diff --git a/Doc/library/msilib.rst b/Doc/library/msilib.rst
index 93e7b84..35e472c 100644
--- a/Doc/library/msilib.rst
+++ b/Doc/library/msilib.rst
@@ -146,7 +146,7 @@ Database Objects
.. seealso::
- `MSIOpenView <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msiopenview.asp>`_
+ `MSIDatabaseOpenView <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msidatabaseopenview.asp>`_
`MSIDatabaseCommit <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msidatabasecommit.asp>`_
`MSIGetSummaryInformation <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msigetsummaryinformation.asp>`_
diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst
index 5442a76..582f2cd 100644
--- a/Doc/library/queue.rst
+++ b/Doc/library/queue.rst
@@ -29,6 +29,7 @@ The :mod:`Queue` module defines the following classes and exceptions:
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the queue size is infinite.
+
.. class:: LifoQueue(maxsize)
Constructor for a LIFO queue. *maxsize* is an integer that sets the upperbound
@@ -36,6 +37,9 @@ The :mod:`Queue` module defines the following classes and exceptions:
block once this size has been reached, until queue items are consumed. If
*maxsize* is less than or equal to zero, the queue size is infinite.
+ .. versionadded:: 2.6
+
+
.. class:: PriorityQueue(maxsize)
Constructor for a priority queue. *maxsize* is an integer that sets the upperbound
@@ -47,6 +51,9 @@ The :mod:`Queue` module defines the following classes and exceptions:
one returned by ``sorted(list(entries))[0]``). A typical pattern for entries
is a tuple in the form: ``(priority_number, data)``.
+ .. versionadded:: 2.6
+
+
.. exception:: Empty
Exception raised when non-blocking :meth:`get` (or :meth:`get_nowait`) is called
diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst
index 57f9b5c..5dfa456 100644
--- a/Doc/library/sched.rst
+++ b/Doc/library/sched.rst
@@ -41,13 +41,39 @@ Example::
From print_time 930343700.273
930343700.276
+In multi-threaded environments, the :class:`scheduler` class has limitations
+with respect to thread-safety, inability to insert a new task before
+the one currently pending in a running scheduler, and holding up the main
+thread until the event queue is empty. Instead, the preferred approach
+is to use the :class:`threading.Timer` class instead.
+
+Example::
+
+ >>> import time
+ >>> from threading import Timer
+ >>> def print_time():
+ ... print "From print_time", time.time()
+ ...
+ >>> def print_some_times():
+ ... print time.time()
+ ... Timer(5, print_time, ()).start()
+ ... Timer(10, print_time, ()).start()
+ ... time.sleep(11) # sleep while time-delay events execute
+ ... print time.time()
+ ...
+ >>> print_some_times()
+ 930343690.257
+ From print_time 930343695.274
+ From print_time 930343700.273
+ 930343701.301
+
.. _scheduler-objects:
Scheduler Objects
-----------------
-:class:`scheduler` instances have the following methods:
+:class:`scheduler` instances have the following methods and attributes:
.. method:: scheduler.enterabs(time, priority, action, argument)
@@ -98,3 +124,10 @@ Scheduler Objects
the calling code is responsible for canceling events which are no longer
pertinent.
+.. attribute:: scheduler.queue
+
+ Read-only attribute returning a list of upcoming events in the order they
+ will be run. Each event is shown as a :term:`named tuple` with the
+ following fields: time, priority, action, argument.
+
+ .. versionadded:: 2.6
diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst
index 790cacb..1ffe812 100644
--- a/Doc/library/smtplib.rst
+++ b/Doc/library/smtplib.rst
@@ -184,6 +184,16 @@ An :class:`SMTP` instance has the following methods:
necessary to call this method explicitly. It will be implicitly called by
:meth:`sendmail` when necessary.
+.. method:: SMTP.ehlo_or_helo_if_needed()
+
+ This method call :meth:`ehlo` and or :meth:`helo` if there has been no
+ previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO``
+ first.
+
+ :exc:SMTPHeloError
+ The server didn't reply properly to the ``HELO`` greeting.
+
+ .. versionadded:: 2.6
.. method:: SMTP.has_extn(name)
@@ -230,6 +240,22 @@ An :class:`SMTP` instance has the following methods:
If *keyfile* and *certfile* are provided, these are passed to the :mod:`socket`
module's :func:`ssl` function.
+ If there has been no previous ``EHLO`` or ``HELO`` command this session,
+ this method tries ESMTP ``EHLO`` first.
+
+ .. versionchanged:: 2.6
+
+ :exc:`SMTPHeloError`
+ The server didn't reply properly to the ``HELO`` greeting.
+
+ :exc:`SMTPException`
+ The server does not support the STARTTLS extension.
+
+ .. versionchanged:: 2.6
+
+ :exc:`RuntimeError`
+ SSL/TLS support is not available to your python interpreter.
+
.. method:: SMTP.sendmail(from_addr, to_addrs, msg[, mail_options, rcpt_options])
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 406c136..7d2dea0 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -562,7 +562,7 @@ correspond to Unix system calls applicable to sockets.
:platform: Windows
- The `meth:ioctl` method is a limited interface to the WSAIoctl system
+ The :meth:`ioctl` method is a limited interface to the WSAIoctl system
interface. Please refer to the MSDN documentation for more information.