The methods below look in a string to find if it has any python methods.
def there_is_a_call( string ):
return string.find(\'(\') > -1
def find_and_rem
Some more explanation here.
a = find_and_remove_functions( 'func() and some more()' , [] )
prints a list because there is a line print( found_functions )
being executed.
a
is assigned to the result of find_and_remove_functions
and, since the function returns nothing after the set of recursive calls (see your else
part doesn't have a return
), it is assigned to None
.
Here's a simple example of what is happening:
>>> def test():
... print "test"
...
>>> a = test()
test
>>> print(a)
None
>>> a is None
True