I have these functions, and I'm getting errors, with the do_twice functions, but I'm having problems debugging it
#!/usr/bin/python
#functins exercise 3.4
def do_twice(f):
f()
f()
def do_four(f):
do_twice(f)
do_twice(f)
def print_twice(str):
print str + 'one'
print str + 'two'
str = 'spam'
do_four(print_twice(str))
debugger errors
:!python 'workspace/python/functions3.4.py'
spamone
spamtwo
Traceback (most recent call last):
File "workspace/python/functions3.4.py", line 18, in <module>
do_four(print_twice(str))
File "workspace/python/functions3.4.py", line 9, in do_four
do_twice(f)
File "workspace/python/functions3.4.py", line 5, in do_twice
f()
TypeError: 'NoneType' object is not callable
shell returned 1
str; that's the name of one of the most important built-in types in Python, and the function you use to get the friendly representation of any object, so you don't want to hide it.