docstring challenge
Posted: Thu Jul 12, 2018 1:00 pm
Hi, I am running MicroPython on a Pyboard and I am new to Python, but not to programming.
I found online a site explaining the use of DocString and i defined a function 'nonsense' in a module 'clock.py' :
[code]
# file clock.py : Clock Functions
import pyb
def nonsense():
'''test doc string'''
return 'ClapClap'
[/code]
That works fine, but the function does not have that docstring:
[code]
>>> import clock
>>> print(clock.nonsense())
ClapClap
>>> help(clock.nonsense)
object <function nonsense at 0x200035d0> is of type function
>>> print(clock.nonsense)
<function nonsense at 0x200035d0>
[/code]
What am i doing wrong here?
I found online a site explaining the use of DocString and i defined a function 'nonsense' in a module 'clock.py' :
[code]
# file clock.py : Clock Functions
import pyb
def nonsense():
'''test doc string'''
return 'ClapClap'
[/code]
That works fine, but the function does not have that docstring:
[code]
>>> import clock
>>> print(clock.nonsense())
ClapClap
>>> help(clock.nonsense)
object <function nonsense at 0x200035d0> is of type function
>>> print(clock.nonsense)
<function nonsense at 0x200035d0>
[/code]
What am i doing wrong here?