Commit 7f265f55 authored by Robert Bradshaw's avatar Robert Bradshaw

...

parents 490889d3 89c93887
__doc__ = """
>>> b(1,2,3)
>>> b(1,2,3,4)
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (4 given)
>>> c(1,2)
>>> c(1,2,3)
>>> c(1,2,3,4)
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (4 given)
TypeError: function takes at most 3 arguments (4 given)
>>> d(1,2)
>>> d(1,2, c=1)
......@@ -63,20 +69,23 @@ __doc__ = """
TypeError: required keyword argument 'c' is missing
"""
def c(a, b, c):
z = 33
def b(a, b, c):
pass
def c(a, b, c=1):
pass
def d(a, b, *, c = 88):
z = 44
pass
def e(a, b, c = 88, **kwds):
z = 55
pass
def f(a, b, *, c, d = 42):
z = 66
pass
def g(a, b, *, c, d = 42, e = 17, f, **kwds):
z = 77
pass
def h(a, b, *args, c, d = 42, e = 17, f, **kwds):
z = 88
pass
......@@ -2,6 +2,12 @@ __doc__ = """
>>> f(1.0, 2.95)[0] == f(1.0, 2.95)[1]
True
>>> g(4)
1024
>>> h(4)
625
>>> constant_py() == 2L ** 10
True
......@@ -17,6 +23,12 @@ def f(obj2, obj3):
obj1 = obj2 ** obj3
return flt1, obj1
def g(i):
return i ** 5
def h(i):
return 5 ** i
def constant_py():
result = 2L ** 10
return result
......
__doc__ = """
>>> test1( (1,2,3) )
1
>>> test3( (1,2,3) )
3
>>> test( (1,2,3) )
3
>>> testnonsense()
Traceback (most recent call last):
TypeError: 'int' object is not iterable
"""
def test1(t):
t,a,b = t
return t
def test3(t):
a,b,t = t
return t
def test(t):
t,t,t = t
return t
def testnonsense():
t,t,t = 1*2
return t
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment