syntax difference

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Jun 19 21:19:37 EDT 2018


On Wed, 20 Jun 2018 07:52:31 +1000, Chris Angelico wrote:

>> What do you do in python when a local function variable needs to retain
>> its value? I'm sure it can do it, but I bet it's not as simple as how I
>> do it.
>>
> What do you mean, "retain its value"? Do you mean the way closures work?

I think that Bart means something like static variables in C. That's 
something I'd like to see Python get. The simplest work-around we have is 
to put the static variable in the function parameter list as if it were 
an argument of the function.


>> Multi-level loop break? Separators in numbers? I think that one is
>> finally in.
> 
> Multi-level loop break is most commonly spelled "return".

Not in languages that have a multi-level break.


> In over two
> decades of programming, the number of times I've needed to break out of
> multiple loops without breaking out of an entire function can be counted
> on the fingers of one hand. Specifically, three times. In nearly three
> decades.

Okay. The number of times I've wanted an asynchronous function so far has 
been zero, therefore the feature must be useless, right?

*wink*



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list