[Tutor] What do each of these functions do?

Danny Yoo dyoo at hashcollision.org
Mon Feb 15 20:42:01 EST 2016

On Mon, Feb 15, 2016 at 4:00 PM, Tom Brodle <tbrodle at hotmail.com> wrote:

> What do the following two lines of code do, individually,  and where in the code does the pointer or (program counter) end up after it has finished that line, assuming it is the last line of code in each of two programs?
> GPIO.cleanup()
> quit(code=None)

As in regular human language, the terms we use don't have a universal
meaning: they are sensitive to the context of the usage.  On
Python-tutor, we try to stay within the context of the Standard
Library, which comes provided when we use the Python language as a
basic part of the installation.

The unqualified "quit" probably refers to the built-in quit in
Python's standard library.  If we look at:


we should eventually find the reference to:


which explains what the quit function does, and it matches
signature-wise with the usage you're showing us, so I think that's the
right "quit".  Please read the docs there and feel free to ask
questions if you need more clarification on its meaning.

Note that GPIO doesn't show up in the index of known modules or
functions in the Python Standard Library.  I looked through:


and it does not occur there.

One part of your question left out some crucial information: in what
context did you see these lines?  Knowing where you saw these lines
would provide a clue.

My best guess is that GPIO is defined by the Python libraries provided
by the Raspberry Pi project.  Is that true?  If that's the case,
please see:


In particular, within the BasicUsage link, there's a section in the
raspberry-pi documentation that talks more about what GPIO.cleanup()
does.  But if that's the case, this is very domain-specific, and you
may want to ask Pi-related questions on a forum such as:


since the folks there will be familiar with the specific details of
the functions that Raspberry Pi introduces.

More information about the Tutor mailing list