On Mon, Nov 15, 2021 at 5:05 AM Christopher Barker wrote:
>
> On Sun, Nov 14, 2021 at 6:05 AM Steven D'Aprano wrote:
>>
>> global a = 3
>
>
> The issue i see is that Python doesn't have declarations. So you could use
> the name, a in multiple places. what would this mean:
>
> a = 34
>
> glob
On Mon, Nov 15, 2021 at 4:57 AM Christopher Barker wrote:
>
> On Sun, Nov 14, 2021 at 9:51 AM Chris Angelico wrote:
>>
>> Also, it's entirely possible that future
>> versions of Python will have a concept of optional arguments that
>> don't *have* defaults,
>
>
> As noticed earlier in this threa
On Sun, Nov 14, 2021 at 6:05 AM Steven D'Aprano wrote:
> global a = 3
>
The issue i see is that Python doesn't have declarations. So you could use
the name, a in multiple places. what would this mean:
a = 34
global a = 0
would it mean that the first a was loca, and the second local? or wo
On Sun, Nov 14, 2021 at 9:51 AM Chris Angelico wrote:
> Also, it's entirely possible that future
> versions of Python will have a concept of optional arguments that
> don't *have* defaults,
As noticed earlier in this thread, it seems it's currently possible to do
that with functions written in
On Mon, Nov 15, 2021 at 4:18 AM Peter O'Connor
wrote:
>
> On Mon, Mar 22, 2021 at 1:28 PM Caleb Donovick
> wrote:
>>
>> ... One could do something like:
>> ```
>> def fun(a, b=0): ...
>> def wraps_fun(args, b=inspect.signature(fun).parameters['b'].default): ...
>> ```
>> But I would hardly call
On Mon, Mar 22, 2021 at 1:28 PM Caleb Donovick
wrote:
> ... One could do something like:
> ```
> def fun(a, b=0): ...
> def wraps_fun(args, b=inspect.signature(fun).parameters['b'].default): ...
> ```
> But I would hardly call that clear.
>
> Caleb
>
I like this approach too - it just needs a c
Hi Jonathan,
Does this global/nonlocal prefix idea of yours allow us to do anything
new that we can't do now?
At first glance, it looks like all it will do is increase the complexity
of the language, making it harder for the interpreter and third party
tools to identify globals, without any in
Usually when we want to make a variable/def/class etc global, we can just
declare `global v` at the beginning, but I feel like there could be a better
way to do that.
So my idea is to allow doing stuff like
`global a = 3`
or
`nonlocal def x(): ...`
or even
`for global i in []: ...`
in add