More pythonic way to nest functions
<p>Here is the code that I have:</p>

<pre><code>def reallyquit():
        from easygui import boolbox
        if __debug__: print ("realy quit?")
        answer = boolbox("Are you sure you want to Quit?")
        if answer == 1:
            sys.exit()
        return

columns = ['adr1','adr2','spam','spam', 'spam']

Street = choicebox("Street Address?", title, columns)
    while Street == None:
        reallyquit()
        Street = choicebox("Street Address?", title, columns)
</code></pre>

<p>Is there a more pythonic way to recursively ask a question if a user closes a box inadvertently? Mainly looking for tips on the last 4 lines, but feel free to critique the rest.</p>

<p>I think this is more idiomatic than using a sentinel variable:</p>

<pre><code>while True:
    street = choicebox("Street Address?", title, columns)
    if street is None:
        reallyquit()
    else:
        break
</code></pre>

<p>Also, consider using the <a href="https://docs.python.org/3/library/logging.html" rel="nofollow"><code>logging</code></a> module for your debug printing, so instead of <code>if __debug__: print(whatever)</code> you just have <code>logging.debug(whatever)</code> and set the logging level.</p>

python python-2.7 easygui