Functions continuing to ru after returning something?

Bradley Hintze bradley.h at
Tue Aug 31 02:05:28 CEST 2010

I may be having a brain fart, but is it at all possible to have a
function first return a value then continue its calculation. Like this
simple example:

my_var = 5
def my_function():
    return my_var
    my_var +=1

This obviously won't work as written but is there a cleaver way around this.

Bradley J. Hintze
Graduate Student
Duke University
School of Medicine

More information about the Python-list mailing list