[Python-checkins] r53894 - sandbox/trunk/pep362/pep362.py sandbox/trunk/pep362/test_pep362.py
brett.cannon
python-checkins at python.org
Sat Feb 24 22:52:28 CET 2007
Author: brett.cannon
Date: Sat Feb 24 22:52:24 2007
New Revision: 53894
Modified:
sandbox/trunk/pep362/pep362.py
sandbox/trunk/pep362/test_pep362.py
Log:
Remove some dead code.
Modified: sandbox/trunk/pep362/pep362.py
==============================================================================
--- sandbox/trunk/pep362/pep362.py (original)
+++ sandbox/trunk/pep362/pep362.py Sat Feb 24 22:52:24 2007
@@ -166,39 +166,6 @@
result += ")"
return result
- @classmethod
- def __tuple_bind_ok(cls, tuple_, arg):
- """Verify that 'arg' will unpack properly to be used with 'tuple_'."""
- try:
- if len(tuple_) != len(arg):
- return False
- except TypeError:
- raise BindError("cannot determine the length of the argument")
- if (hasattr(arg, '__iter__') and hasattr(arg, 'next') and
- callable(arg.__iter__) and callable(arg.next)):
- raise IndexError("do not want to mutate an iterator")
- for tuple_item, arg_item in zip(tuple_, arg):
- if isinstance(tuple_item, tuple):
- if not cls.__tuple_bind_ok(tuple_item, arg_item):
- return False
- return True
-
- @classmethod
- def __positional_bind(cls, parameter, arg, bindings):
- """Bind 'argument' to 'parameter' in 'bindings' if it is a legitimate
- binding.
-
- A binding can be illegitimate if the parameter is a tuple and the
- argument will either unpack improperly or it cannot be determined if it
- will without possibly mutating the object (e.g., if it is an
- iterator).
-
- """
- if isinstance(parameter, tuple):
- if not cls.__tuple_bind_ok(parameter, arg):
- raise TypeError("cannot unpack argument for %s" % parameter)
- bindings[parameter] = arg
-
def bind(self, *args, **kwargs):
"""Return a dictionary mapping function arguments to their parameter
variables, if possible.
Modified: sandbox/trunk/pep362/test_pep362.py
==============================================================================
--- sandbox/trunk/pep362/test_pep362.py (original)
+++ sandbox/trunk/pep362/test_pep362.py Sat Feb 24 22:52:24 2007
@@ -303,8 +303,6 @@
# Only one argument should pair up with a parameter.
sig = pep362.Signature(pep362_fodder.no_default_args)
self.failUnlessRaises(pep362.BindError, sig.bind, 1, a=1)
- # Technically handled by Python itself.
- self.failUnlessRaises(pep362.BindError, sig.bind, a=1, a=2)
def XXX_test_do_not_consume_iterators(self):
def gen():
More information about the Python-checkins
mailing list