[Python-ideas] Re: Have del return a value

2023-09-12 Thread Daniel Walker
Makes sense. On Tue, Sep 12, 2023 at 2:55 AM Rob Cliffe via Python-ideas < python-ideas@python.org> wrote: > > > On 08/09/2023 22:19, Christopher Barker wrote: > > On Fri, Sep 8, 2023 at 11:00 AM Barry Scott > wrote: > >> I see no need for del to return anything, you already have the reference >

[Python-ideas] Re: Have del return a value

2023-09-11 Thread Rob Cliffe via Python-ideas
On 08/09/2023 22:19, Christopher Barker wrote: On Fri, Sep 8, 2023 at 11:00 AM Barry Scott wrote: I see no need for del to return anything, you already have the reference in foo. The times that foo is dropped at module level are rare enough to not need special syntax. I agr

[Python-ideas] Re: Have del return a value

2023-09-11 Thread Rob Cliffe via Python-ideas
On 08/09/2023 22:19, Christopher Barker wrote: On Fri, Sep 8, 2023 at 11:00 AM Barry Scott wrote: I see no need for del to return anything, you already have the reference in foo. The times that foo is dropped at module level are rare enough to not need special syntax. I agr

[Python-ideas] Re: Have del return a value

2023-09-09 Thread Dom Grigonis
Also, check out https://docs.python.org/3/library/weakref.html Maybe it will not provide exactly what you indicated, but might get some ideas how to do things differently. — Now is better than never. Although never is often better than *right* no

[Python-ideas] Re: Have del return a value

2023-09-08 Thread Jeff Allen
On 06/09/2023 03:47, Daniel Walker wrote: Perhaps this is a solution in search of a problem but I recently encountered this situation in one of my projects. I have an object, foo, which, due to the references it contains, I'd rather not keep around longer than necessary. I use foo to instant

[Python-ideas] Re: Have del return a value

2023-09-08 Thread Christopher Barker
On Fri, Sep 8, 2023 at 11:00 AM Barry Scott wrote: > I see no need for del to return anything, you already have the reference > in foo. > The times that foo is dropped at module level are rare enough to not need > special syntax. > I agree - using del is very rare in my code. The use case of pas

[Python-ideas] Re: Have del return a value

2023-09-08 Thread Barry Scott
> On 6 Sep 2023, at 03:47, Daniel Walker wrote: > > I use foo to instantiate another object: > > bar = Bar(foo) > > bar is free to manipulate foo however it wants and even del it if necessary. foo is a reference to an object, it is not an object in its own right. You can say that bar is

[Python-ideas] Re: Have del return a value

2023-09-07 Thread Daniel Walker
Ah! I like that! On Thu, Sep 7, 2023 at 5:24 PM Tiago Illipronti Girardi < tiagoigira...@gmail.com> wrote: > You would be deleting the name, not the value. `unbind` would be a better > keyword. > ___ > Python-ideas mailing list -- python-ideas@python.o

[Python-ideas] Re: Have del return a value

2023-09-07 Thread Tiago Illipronti Girardi
You would be deleting the name, not the value. `unbind` would be a better keyword. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.

[Python-ideas] Re: Have del return a value

2023-09-07 Thread Daniel Walker
Maybe a new keyword like `delvalue`? On Thu, Sep 7, 2023 at 10:02 AM Chris Angelico wrote: > On Thu, 7 Sept 2023 at 23:51, Daniel Walker wrote: > > > > Perhaps this is a solution in search of a problem but I recently > encountered this situation in one of my projects. > > > > I have an object,

[Python-ideas] Re: Have del return a value

2023-09-07 Thread Chris Angelico
On Thu, 7 Sept 2023 at 23:51, Daniel Walker wrote: > > Perhaps this is a solution in search of a problem but I recently encountered > this situation in one of my projects. > > I have an object, foo, which, due to the references it contains, I'd rather > not keep around longer than necessary. > >