File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ def list_functions():
9090 )
9191 return '\n ' .join (s )
9292
93- def function_help (function ):
93+ def function_help (function , return_as_string = False ):
9494 function = FUNCTIONS [function ]
9595
9696 s = [
@@ -117,7 +117,10 @@ def function_help(function):
117117
118118 s = "\n " .join (s )
119119
120- return s
120+ if return_as_string :
121+ return s
122+ else :
123+ print (s )
121124
122125def input_help ():
123126 s = [
Original file line number Diff line number Diff line change @@ -129,13 +129,18 @@ def __getattr__(self, name):
129129 def __getitem__ (self , name ):
130130 return self .__getattr__ (name )
131131
132- def help (self , name = None ):
132+ def help (self , name = None , return_as_string = False ):
133133 if name :
134134 if name .upper () == 'INPUT' :
135- return input_help ()
135+ return_val = input_help ()
136136 try :
137- return function_help (name )
137+ return_val = function_help (name , return_as_string )
138138 except KeyError :
139- return "Function '%s' does not exist." % name
139+ return_val = "Function '%s' does not exist." % name
140140 else :
141- return list_functions ()
141+ return_val = list_functions ()
142+
143+ if return_as_string :
144+ return return_val
145+ elif return_val :
146+ print (return_val )
You can’t perform that action at this time.
0 commit comments