I'll update the code to use a global boolean instead of making the recursive call to makeSelection() as such:

if __name__ == "__main__":
    print "Hockey Roster Application\n\n"
    cfg = Configuration().configure()

    factory = cfg.buildSessionFactory()
    global runApp
    runApp = True
    while runApp:
        makeSelection()

Then within makeSelection() I will make runApp = False when 5 is pressed...that will effectively end the iteration and the program will stop.

Thanks for the note.

Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
Twitter ID:  javajuneau


On Sun, Aug 9, 2009 at 8:57 AM, Josh Juneau <juneau001@gmail.com> wrote:
Sylvain-

I agree with Frank that we can revisit this code and optimize it.  Thanks for the comment.

Best

Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
Twitter ID:  javajuneau



On Sun, Aug 9, 2009 at 8:15 AM, Frank Wierzbicki <fwierzbicki@gmail.com> wrote:
On Sun, Aug 9, 2009 at 5:58 AM, Sylvain Leroux<sl20@wanadoo.fr> wrote:
> Does Jython/Python handle gracefully tail call recursion - as it appears
> to be here? Or could it leads to a stack overflow if the user feeds the
> program with invalid inputs? Of course, this in not a problem with the
> sample program, but the reader - especially with functional language
> background - could be tempted to generalize this anti-pattern.
Jython/Python do not specially handle tail call recursion, a stack
overflow is a definite possibility when recursion is used.  This is a
deliberate design choice by Guido van Rossum, see
http://neopythonic.blogspot.com/2009/04/final-words-on-tail-calls.html.
 It might be a good idea to revisit this code to see if we can use an
iterative approach (which is the more common idiom in Python).

-Frank

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users