How to do static function variables in Python

preview_player
Показать описание
Please subscribe.
Teaching: How python functions can 'remember' values, similar to C language static locals.
Problem: random sequence that does not repeat locally as function inc()
Solution: use function object attribute
Рекомендации по теме
Комментарии
Автор

I'm using this technique for having multiple threads output in a synchronized manner so threads don't print text through eachother

rednassie
Автор

HI, What caught my eye was the mouse over on keywords that got python documentation. What editor do you use that allows for that? Secondly, how did your python script know to spit out 35 numbers in the second script. I have poor vision so I may have missed that code you used.

bruce
welcome to shbcf.ru