Functions continuing to ru after returning something?
MRAB
python at mrabarnett.plus.com
Mon Aug 30 20:12:09 EDT 2010
On 31/08/2010 01:05, Bradley Hintze 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.
>
Do you mean a generator?
More information about the Python-list
mailing list