Python Forum
Reference for (Directional) commands
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reference for (Directional) commands
#1
hello,

I have been able to find helpful lists of key words to be used in Python - such as - "if", "print", "while".

And

I have been able to find helpful lists of built-in functions to be used in Python - such as - "input()", "len", "max".

_____

But in neither of these lists did I see some of what I see in Pythons' script. . .

Things like "setheading()", "sleep()", "up()", "shape"

Does anyone know of a resource that is a little more comprehensive (than just the key words and built-in functions) that might include directional or formatting commands such as "setheading()", "sleep()", "up()", "shape."?

Thanks!
Reply
#2
(Mar-22-2017, 02:08 PM)mattkrebs Wrote: Things like "setheading()", "sleep()", "up()", "shape"

These are 'functions' used in imported modules (in this case, "turtle" ?).  In cases like this you must check the doc's for the module itself.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
Those are just functions.  Their meaning is entirely tied to whatever program/framework/api you happen to be looking at, and don't mean anything at all to python in general (except sleep, which might be from the time module).

If you're in an interactive prompt, you can find all available functions by typing dir().  If there's one that you don't know what it does or how to use it, then call help() on it.  

>>> import time
>>> dir()
['__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'time']
>>> dir(time)
['_STRUCT_TM_ITEMS', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'altzone', 'asctime', 'clock', 'ctime', 'daylight', 'get_clock_info', 'gmtime', 'localtime', 'mktime', 'monotonic', 'perf_counter', 'process_time', 'sleep', 'strftime', 'strptime', 'struct_time', 'time', 'timezone', 'tzname']
>>> help(time.sleep)
Help on built-in function sleep in module time:

sleep(...)
   sleep(seconds)

   Delay execution for a given number of seconds.  The argument may be
   a floating point number for subsecond precision.

>>>
Reply
#4
One thing you can do this is a real hack!:

If you have the program where these functions or methods are used
you can do:
  • You have the name of the module that they came from. There will be an associated import statement
  • from command line (preferable cmnder (you can get it here: http://cmder.net/) type the following(for each import):

Then for each module
λ python
>>> import sys
>>> sys.stdout = open('ModuleInfo.txt', 'w')
>>> # Following two lines for each imported module
>>> import modulename
>>> help('modulename')
>>> # when done
>>> quit()
This will show detailed help (including all methods and attributes)
for each of the modules.
The last line of each help list will show the path to the code, In case you want to examine it

All of the help will be in file ModuleInfo.txt
Reply
#5
The built-ins:

The keywords:
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#6
And also __file__ for module location
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Good Example for bi-directional Communication between Python and Windows (C#) raybowman 0 1,600 Nov-14-2020, 06:44 PM
Last Post: raybowman
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,553 Sep-07-2020, 08:02 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020