diff --git a/tornado/gen.py b/tornado/gen.py index 2513a836..434ad4bd 100644 --- a/tornado/gen.py +++ b/tornado/gen.py @@ -64,6 +64,7 @@ is an `Arguments` object, which is a named tuple ``(args, kwargs)``. """ from __future__ import absolute_import, division, print_function, with_statement +import collections import functools import operator import sys @@ -414,20 +415,4 @@ class Runner(object): else: return False -# in python 2.6+ this could be a collections.namedtuple - - -class Arguments(tuple): - """The result of a yield expression whose callback had more than one - argument (or keyword arguments). - - The `Arguments` object can be used as a tuple ``(args, kwargs)`` - or an object with attributes ``args`` and ``kwargs``. - """ - __slots__ = () - - def __new__(cls, args, kwargs): - return tuple.__new__(cls, (args, kwargs)) - - args = property(operator.itemgetter(0)) - kwargs = property(operator.itemgetter(1)) +Arguments = collections.namedtuple('Arguments', ['args', 'kwargs']) diff --git a/tornado/netutil.py b/tornado/netutil.py index 1a80d5de..fd01c91a 100644 --- a/tornado/netutil.py +++ b/tornado/netutil.py @@ -87,7 +87,7 @@ def bind_sockets(port, address=None, family=socket.AF_UNSPEC, backlog=128, flags return sockets if hasattr(socket, 'AF_UNIX'): - def bind_unix_socket(file, mode=int('600', 8), backlog=128): + def bind_unix_socket(file, mode=0o600, backlog=128): """Creates a listening unix socket. If a socket with the given name already exists, it will be deleted. diff --git a/website/sphinx/gen.rst b/website/sphinx/gen.rst index 4281eb35..c447c089 100644 --- a/website/sphinx/gen.rst +++ b/website/sphinx/gen.rst @@ -12,7 +12,7 @@ ------------ Instances of the following classes may be used in yield expressions - in the generator. + in the generator. .. autoclass:: Task @@ -25,4 +25,10 @@ Other classes ------------- - .. autoclass:: Arguments + .. class:: Arguments + + The result of a yield expression whose callback had more than one + argument (or keyword arguments). + + The `Arguments` object can be used as a tuple ``(args, kwargs)`` + or an object with attributes ``args`` and ``kwargs``.