In article <65e8a017-abcb-49ad-8867-bc473f83e...@s39g2000yqj.googlegroups.com>,
Bearophile  <bearophileh...@lycos.com> wrote:
>Steven D'Aprano:
>
>> (3) Create an inner function, then call that.
>
>Several people after someone gives this anwer.
>
>
>> My personal opinion is that if you really need a local scope
>> inside a function, the function is doing too much and should be split up.
>
>I agree. And a way to split a function is to define an inner function,
>that's one of their main purposes. No need to add other things to the
>language as the OP suggests.

There are exceptions. E.g. implementations of quicksort have a
recursive inner function, that you may prefer to not have exposed.
Also there may be data to communicate to or between instances of
the inner function.

At least that is the situation in most languages. I would be
interested to learn if and how Python gets around that.

>
>Bye,
>bearophile

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
alb...@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to