Functions continuing to ru after returning something?

Chris Rebert crebert at ucsd.edu
Mon Aug 30 23:42:22 EDT 2010


On Mon, Aug 30, 2010 at 5:05 PM, Bradley Hintze
<bradley.h at aggiemail.usu.edu> wrote:
> 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.

And what do you want to happen with the code the value was returned to?

Cheers,
Chris



More information about the Python-list mailing list