[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Rob Cliffe via Python-ideas



On 12/09/2023 11:54, Dom Grigonis wrote:

Yes, Thank you!

So 2 solutions now. They both solve what I have encountered. Beyond that, they 
differ by:

a) f-string print(f’{=a.method}’)   # ‘a.method’
No new builtin needed.
Simply reprints expression representation.


I don't understand your semantics either.  What would be the difference 
between your proposed

    print(f’{=a.method}’)
and simply writing
    print('a.method')
?

Would it be just that the syntax inside the curly braces is checked for 
legality,

so that
    print(f'{=!?}')
would not be allowed (presumably it would cause a SyntaxError)
?

Or do you want to check that the expression can be evaluated at run time?
You could achieve that by simply writing
    a.method

As for the example in your first post:
var = 710
variable_name = [k fork, v inlocals().items()ifv == 710][0]
print("Your variable name is "+ variable_name)

it does "work", but it doesn't make much sense with Python's semantics.  
You could have two identifiers bound to the same object; which one you 
got hold of would be essentially random.


Puzzled.
Rob Cliffe___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/GTDF4Q2OYWWSTHWXTQI6TSEXHJIRWX4Z/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Dom Grigonis
I agree.

What I meant is that it is unreliable with `v is 710` and even more unreliable 
with `v == 710` as “==“ is less strict than “is”.

DG

> On 12 Sep 2023, at 21:03, Rob Cliffe  wrote:
> 
> 
>>> As for the example in your first post:
>>> var = 710
>>> variable_name = [k for k, v in locals().items() if v == 710][0] 
>>> print("Your variable name is " + variable_name)
>>> 
>>> it does "work", but it doesn't make much sense with Python's semantics.  
>>> You could have two identifiers bound to the same object; which one you got 
>>> hold of would be essentially random.
>> Yes, if `==` was replaced by `is`. Currently it is even more random as it 
>> would return the first one which evaluates __eq__() positively.
>> 
> I'm not sure what you're saying.  In:
> var1 = 710
> var2 = 710
> variable_names = [k for k, v in locals().items() if v is 710]
> Depending on the Python implementation, variable_names may be ['var1', 
> 'var2'] or it may be empty (depending on whether 710 is interned).  It could 
> also in theory contain one of 'var1', 'var2' but not the other, though I 
> would be surprised if that happened in practice.  The behaviour is not 
> guaranteed and should not be relied on.
> Rob Cliffe

___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JOCYEOKCQHEOLKF2LA2YMCFY7BL7XTKY/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Rob Cliffe via Python-ideas



As for the example in your first post:
var = 710
variable_name = [k fork, v inlocals().items()ifv == 710][0]
print("Your variable name is "+ variable_name)

it does "work", but it doesn't make much sense with Python's 
semantics.  You could have two identifiers bound to the same object; 
which one you got hold of would be essentially random.
Yes, if `==` was replaced by `is`. Currently it is even more random as 
it would return the first one which evaluates __eq__() positively.



I'm not sure what you're saying.  In:
    var1 = 710
    var2 = 710
    variable_names = [k for k, v in locals().items() if v is 710]
Depending on the Python implementation, variable_names may be ['var1', 
'var2'] or it may be empty (depending on whether 710 is interned).  It 
could also in theory contain one of 'var1', 'var2' but not the other, 
though I would be surprised if that happened in practice.  The behaviour 
is not guaranteed and should not be relied on.

Rob Cliffe___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/AI4OQP4SNIZORCI4JFJ5CV6QUVKIGYIB/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Dom Grigonis
Good points, thanks for reply.

> Or do you want to check that the expression can be evaluated at run time?
> You could achieve that by simply writing
> a.method
Yes, the point is that it would be checked for legality of expression itself. 
Whether to check if it actually evaluates without an error or not would both 
work. I see pros and cons in both cases. Maybe not evaluating is better as 
evaluation can always be checked separately if needed and eventually will be 
checked on actual usage anyway.

> As for the example in your first post:
> var = 710
> variable_name = [k for k, v in locals().items() if v == 710][0] 
> print("Your variable name is " + variable_name)
> 
> it does "work", but it doesn't make much sense with Python's semantics.  You 
> could have two identifiers bound to the same object; which one you got hold 
> of would be essentially random.
Yes, if `==` was replaced by `is`. Currently it is even more random as it would 
return the first one which evaluates __eq__() positively.

That's exactly why I started this. This was to illustrate that I could not find 
any robust way to do it.

DG.

___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/O4UIFJQ7IYR2UZWYLNAQOOXQFJJNRXVT/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Dom Grigonis
Yes, Thank you!

So 2 solutions now. They both solve what I have encountered. Beyond that, they 
differ by:

a) f-string print(f’{=a.method}’)   # ‘a.method’
No new builtin needed.
Simply reprints expression representation.

b) print(nameof(a.method))   # ‘method’
New builtin.
Has its own logic.
Its extra functionality on top of what I have suggested can already 
achieved in python via a.method.__name__

I think f-string approach if optimal. It adds new feature, without 
functionality overlap and doesn’t crowd the namespace. Also, implementation is 
simpler as all what is required seems to be in the place already.

I have little preference regarding syntax, but
f’{=expression}’ does seem to make sense.

Regards,
DG

> On 12 Sep 2023, at 13:14, Valentin Berlier  wrote:
> 
> Do you mean something like C# nameof()? 
> https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof
> ___
> 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.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/USPQDMEA7ACWH2T56ZYTWBGG7SMT3RIF/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/P7KERJ2O5QWON5CZGM5LTMNVP4AZXHSK/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Dom Grigonis
An addition to f-strings:
a = 1
b = 1
print(f'{a+b}') # '2'
print(f'{a+b=}') # 'a+b=2'
# I suggest adding this too
print(f'{=a+b}')# 'a+b'
It is different from putting it in quotes in a way how editors interpret it. 
E.g. changing the variable name in PyCharm would unambiguously change f-string 
as well, while it would not change the string literal.

Also, one could argue that it can just be extracted by 
`f’{a+b=}’.split(‘=‘)[0]`, but it is of course sub-optimal given the 
possibility that evaluation is expensive and not required.

DG.


> On 12 Sep 2023, at 13:06, Chris Angelico  wrote:
> 
> On Tue, 12 Sept 2023 at 20:05, Dom Grigonis  wrote:
>> 
>> Please read the next part of my e-mail too. It actually answer your question.
>> 
> 
> I did read it, and it didn't answer the question. Your desired
> semantics are not clear.
> 
> ChrisA
> ___
> 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.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/P5RHZPHTVREEYOG2VSBZYLA6UU33T2X3/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6VVOWCY253PZPMTYNCEXGLH46YDAXN6S/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Valentin Berlier
Do you mean something like C# nameof()? 
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof
___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/USPQDMEA7ACWH2T56ZYTWBGG7SMT3RIF/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Chris Angelico
On Tue, 12 Sept 2023 at 20:05, Dom Grigonis  wrote:
>
> Please read the next part of my e-mail too. It actually answer your question.
>

I did read it, and it didn't answer the question. Your desired
semantics are not clear.

ChrisA
___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/P5RHZPHTVREEYOG2VSBZYLA6UU33T2X3/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Dom Grigonis
Please read the next part of my e-mail too. It actually answer your question.

> On 12 Sep 2023, at 13:00, Chris Angelico  wrote:
> 
> On Tue, 12 Sept 2023 at 19:51, Dom Grigonis  wrote:
>> 
>> It wouldn’t. I know this is weird and not in line of how things work. This 
>> is more about simply getting reference variable name in locals() from the 
>> reference itself. But how would one access the variable name, when once 
>> called it returns the object it points to, not itself. So this would 
>> obviously require an exception in parser itself.
>> 
>> a = object()
>> b = a
>> print(a.__varname__)  # ‘a'
>> print(b.__varname__)  # 'b'
>> print((a + b).__varname__)  # Undefined??? ‘a + b’?
>> 
> 
> I don't understand your desired semantics. Do you just want to take
> whatever is given and put it in quotes?
> 
> ChrisA
> ___
> 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.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/ZWO3FPC2G2AWA5TNINBX4ZHDMKFBWQZN/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/U3R6MHLYKC6R7RX2LG7EACVLOPB6TH5N/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Chris Angelico
On Tue, 12 Sept 2023 at 19:51, Dom Grigonis  wrote:
>
> It wouldn’t. I know this is weird and not in line of how things work. This is 
> more about simply getting reference variable name in locals() from the 
> reference itself. But how would one access the variable name, when once 
> called it returns the object it points to, not itself. So this would 
> obviously require an exception in parser itself.
>
> a = object()
> b = a
> print(a.__varname__)  # ‘a'
> print(b.__varname__)  # 'b'
> print((a + b).__varname__)  # Undefined??? ‘a + b’?
>

I don't understand your desired semantics. Do you just want to take
whatever is given and put it in quotes?

ChrisA
___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ZWO3FPC2G2AWA5TNINBX4ZHDMKFBWQZN/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Dom Grigonis
It wouldn’t. I know this is weird and not in line of how things work. This is 
more about simply getting reference variable name in locals() from the 
reference itself. But how would one access the variable name, when once called 
it returns the object it points to, not itself. So this would obviously require 
an exception in parser itself.
a = object()
b = a
print(a.__varname__)  # ‘a'
print(b.__varname__)  # 'b'
print((a + b).__varname__)  # Undefined??? ‘a + b’?

Actually, it could be easily achieved by what is happening in f-strings:
a = 1
b = 2
print(f'{a+b=}')# 'a+b=2'
# So I would like to be able to have something like
print(f'{=a+b}')# 'a+b'
So now it really looks just an addition to f-strings. They can print
1. value
2. `expression literal`=value
3. What I am asking is: `expression literal` (without value)

One can of course argue that this is the same as just typing it, but the 
difference is that things within curly braces are interpreted as code by the 
editor, which is the whole point.

DG.

> On 12 Sep 2023, at 12:24, Antoine Rozo  wrote:
> 
> Why would an object always be linked to a variable name, and why only one 
> name?
> 
> Le mar. 12 sept. 2023 à 10:23, Dom Grigonis  > a écrit :
> As far as I understand, it is not possible. Is it?
> 
> Something similar to:
> 
> var = 710
> variable_name = [k for k, v in locals().items() if v == 710][0] 
> print("Your variable name is " + variable_name)
> 
> ,except robust.
> 
> Possible ways to expose it:
> * builtin function `varname(obj: object) —> str`
> * object.__varname__ dunder (this one wouldn’t clutter general namespace)
> 
> I am working on some code and just got to the point where it seems I could 
> make use of it. The case is as follows:
> 
> # What I do now:
> class A:
> defaults = dict()
> 
> def set_default(self, a):
> self.defaults['a'] = a
> 
> def make_something(self, a=None):
> a = a if a is not None else self.defaults.get('a')
> return Something(a)
> 
> # What I would like to be able to do:
> class A:
> defaults = dict()
> 
> def set_default(self, a):
> self.defaults[a.__varname__] = a
> 
> def make_something(self, a=None):
> a = a if a is not None else self.defaults.get(a.__varname__)
> return Something(a)
> 
> In this case I like second one, because it allows a tight coupling of 
> variable names, which has the following benefits:
> 1. General simplification, where one doesn’t have to think variable name and 
> its key value in dictionary. Code looks cleaner.
> 2. If one was to change a variable name of `set_default` it would immediately 
> surface as an error.
> 3. For someone working with IDEs or making use of clever multiple selection 
> tools, it would be easy to change all in one go.
> 
> Any reasons why the above would not be a good practice?
> Any reasons why exposing it is not a good idea?
> Would this be difficult to achieve from python dev’s perspective?
> 
> 
> — This one can’t be solved with deferred eval :/ —
> Regards,
> DG
> ___
> 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.org/ 
> 
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/H3O6N2W62EDU75JEQQGN63HETAZNANLP/
>  
> 
> Code of Conduct: http://python.org/psf/codeofconduct/ 
> 
> 
> 
> -- 
> Antoine Rozo
> ___
> 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.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/RINOBZMXRJIHY2U7AYKKA5YAXZ5WJNAP/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/7XLHNXNO4CVRRKUI36W5XU6QGDQWQTKQ/
Code of Conduct: http://python.org/psf/codeofconduct/


[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
>> 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 passing a
> name into a function (or somewhere else?)  and then immediately deleting it
> is rare indeed -- not worth new syntax.
>
> -Chris
>
>
> +1.  The only time I can remember using del to delete a variable is after
> creating a structure with a large memory footprint that is only needed
> temporarily.
> Best wishes
> Rob Cliffe
> ___
> 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.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/RMS3RID2R2NO4V5A3AOKJCUUOCMHXB4Z/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LTPC4FNQFAWYNZEV5F63TOKU2H3ISUYH/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Extract variable name from itself

2023-09-12 Thread Antoine Rozo
Why would an object always be linked to a variable name, and why only one
name?

Le mar. 12 sept. 2023 à 10:23, Dom Grigonis  a
écrit :

> As far as I understand, it is not possible. Is it?
>
> Something similar to:
>
> var = 710
> variable_name = [k for k, v in locals().items() if v == 710][0]
> print("Your variable name is " + variable_name)
>
> ,except robust.
>
> Possible ways to expose it:
> * builtin function `varname(obj: object) —> str`
> * object.__varname__ dunder (this one wouldn’t clutter general namespace)
>
> I am working on some code and just got to the point where it seems I could
> make use of it. The case is as follows:
>
> # What I do now:class A:
> defaults = dict()
>
> def set_default(self, a):
> self.defaults['a'] = a
>
> def make_something(self, a=None):
> a = a if a is not None else self.defaults.get('a')
> return Something(a)
> # What I would like to be able to do:class A:
> defaults = dict()
>
> def set_default(self, a):
> self.defaults[a.__varname__] = a
>
> def make_something(self, a=None):
> a = a if a is not None else self.defaults.get(a.__varname__)
> return Something(a)
>
>
> In this case I like second one, because it allows a tight coupling of
> variable names, which has the following benefits:
> 1. General simplification, where one doesn’t have to think variable name
> and its key value in dictionary. Code looks cleaner.
> 2. If one was to change a variable name of `set_default` it would
> immediately surface as an error.
> 3. For someone working with IDEs or making use of clever multiple
> selection tools, it would be easy to change all in one go.
>
> Any reasons why the above would not be a good practice?
> Any reasons why exposing it is not a good idea?
> Would this be difficult to achieve from python dev’s perspective?
>
>
> — This one can’t be solved with deferred eval :/ —
> Regards,
> DG
> ___
> 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.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/H3O6N2W62EDU75JEQQGN63HETAZNANLP/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
Antoine Rozo
___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RINOBZMXRJIHY2U7AYKKA5YAXZ5WJNAP/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Extract variable name from itself

2023-09-12 Thread Dom Grigonis
As far as I understand, it is not possible. Is it?

Something similar to:

var = 710
variable_name = [k for k, v in locals().items() if v == 710][0] 
print("Your variable name is " + variable_name)

,except robust.

Possible ways to expose it:
* builtin function `varname(obj: object) —> str`
* object.__varname__ dunder (this one wouldn’t clutter general namespace)

I am working on some code and just got to the point where it seems I could make 
use of it. The case is as follows:

# What I do now:
class A:
defaults = dict()

def set_default(self, a):
self.defaults['a'] = a

def make_something(self, a=None):
a = a if a is not None else self.defaults.get('a')
return Something(a)

# What I would like to be able to do:
class A:
defaults = dict()

def set_default(self, a):
self.defaults[a.__varname__] = a

def make_something(self, a=None):
a = a if a is not None else self.defaults.get(a.__varname__)
return Something(a)

In this case I like second one, because it allows a tight coupling of variable 
names, which has the following benefits:
1. General simplification, where one doesn’t have to think variable name and 
its key value in dictionary. Code looks cleaner.
2. If one was to change a variable name of `set_default` it would immediately 
surface as an error.
3. For someone working with IDEs or making use of clever multiple selection 
tools, it would be easy to change all in one go.

Any reasons why the above would not be a good practice?
Any reasons why exposing it is not a good idea?
Would this be difficult to achieve from python dev’s perspective?


— This one can’t be solved with deferred eval :/ —
Regards,
DG___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/H3O6N2W62EDU75JEQQGN63HETAZNANLP/
Code of Conduct: http://python.org/psf/codeofconduct/


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

2023-09-12 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 agree - using del is very rare in my code. The use case of passing a 
name into a function (or somewhere else?)  and then immediately 
deleting it is rare indeed -- not worth new syntax.


-Chris


+1.  The only time I can remember using del to delete a variable is 
after creating a structure with a large memory footprint that is only 
needed temporarily.

Best wishes
Rob Cliffe___
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.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RMS3RID2R2NO4V5A3AOKJCUUOCMHXB4Z/
Code of Conduct: http://python.org/psf/codeofconduct/