inspect.getargspec for function signature

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
rdagger
Posts: 143
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

inspect.getargspec for function signature

Post by rdagger » Sun Jan 07, 2018 7:20 pm

Is there a way to list a function's arguments. I tried inspect.getargspec() from micropython-lib, but I get the following:

Code: Select all

>>> inspect.getargspec(my_test_function)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "inspect.py", line 37, in getargspec
NotImplementedError: This is over-dynamic function, not supported by MicroPython
getfullargspec() and signature() are also not implemented.
help() doesn't provide arguments either in MicroPython.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: inspect.getargspec for function signature

Post by pythoncoder » Mon Jan 08, 2018 6:41 am

I assume you've read differences. I don't think there's any way to do this short of inspecting the source or reading the module docs ( :!: ).
Peter Hinch
Index to my micropython libraries.

User avatar
rdagger
Posts: 143
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: inspect.getargspec for function signature

Post by rdagger » Mon Jan 08, 2018 7:21 am

Thanks for your reply. I find myself checking the source frequently especially for ESP32 specific code.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: inspect.getargspec for function signature

Post by pythoncoder » Tue Jan 09, 2018 6:50 am

Well I agree - the ESP32 port is still "experimental" and the docs aren't what they might be. By contrast the Pyboard docs are so good I seldom need to trawl the code.
Peter Hinch
Index to my micropython libraries.

giri
Posts: 5
Joined: Wed Nov 06, 2019 4:47 pm

Re: inspect.getargspec for function signature

Post by giri » Thu Dec 19, 2019 3:49 pm

So we don't have any way to check source code of a python file after moving to dir() of a device
Import inspect would have been handy, though

Post Reply