[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-07-01 Thread nate lust
All, Thanks for the feedback that everyone has provided. My time will be in short supply in the near term, and so I am going to focus on taking all the input that people have provided and if possible flesh out a stronger proposal. I figured this would also slow the flood of emails on this thread th

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-07-01 Thread nate lust
Steven, Sorry about taking a few days to get back to you. Here is the exact code I ran: def test(): n = 0 def inner(): global g nonlocal n n = g x = n g = x y = x z = y return x for i in range(100): a = inner() fro

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-28 Thread Stephen J. Turnbull
Andrew Barnert writes: > On Jun 26, 2019, at 21:45, Stephen J. Turnbull > wrote: > > > > Chris Angelico writes: > > > >> Then I completely don't understand getself. Can you give an example > >> of how it would be used? So far, it just seems like an utter total > >> mess. > > > > It's

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread nate lust
This is one of the exception cases in my proposal, variables used inside their own methods don't have __getself__ called when they are loaded. The proposal basically reads: class instances that are looked up with a named variable will have __getself__ invoked when the interpreter loads them, excep

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Greg Ewing
Steven D'Aprano wrote: The only risk here is if your refactoring does something silly, such as reusing a variable which overrides assignment: What if the variable is bound inside a loop? Does that count as silly? -- Greg ___ Python-ideas mailing list

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Andrew Barnert via Python-ideas
On Jun 27, 2019, at 16:18, Greg Ewing wrote: > > Andrew Barnert wrote: >> in Lisp, if you replace the setf macro, > > Okay, maybe Lisp wasn't a good example. In the presence of macros, > all bets are off. :-( But at least if you haven't redefined the > universe, local bindings in Lisp behave pre

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Greg Ewing
Sorry if this has already been answered, but if it has I missed it. From your demo: class HistoricVar: def __getself__(self): return self.var What stops the reference to 'self' here from invoking __getself__ again? -- Greg ___ Python-ide

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Greg Ewing
Andrew Barnert wrote: in Lisp, if you replace the setf macro, Okay, maybe Lisp wasn't a good example. In the presence of macros, all bets are off. :-( But at least if you haven't redefined the universe, local bindings in Lisp behave predictably. If you had code involving “x = 2” that stopped

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Greg Ewing
Yanghao Hua wrote: this one, on the other hand, is truly generic and universal. The problem is that it's *too* universal. A __getself__ method would be a sorcerer's-apprentice kind of magic that you can't escape when you don't want it. Suppose you want to inspect an object for debugging purpos

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Andrew Barnert via Python-ideas
On Jun 27, 2019, at 08:59, nate lust wrote: > > There are two (three) important cases when I have exempt __getself__ from > being called. First is when an > object is used in methods defined within itself. This means that self can be > used when defining methods > without triggering recursive b

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Ricky Teachey
> That's mostly available already! > > https://www.python.org/dev/peps/pep-0562/ > Indeed, and I've been using it! There is also the "clumsy and obscure" method of adding properties to modules discussed in PEP 549 : import sys, types class _MyModuleTyp

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Chris Angelico
On Fri, Jun 28, 2019 at 6:36 AM Steven D'Aprano wrote: > > On Fri, Jun 28, 2019 at 03:59:14AM +1000, Chris Angelico wrote: > > > > Are we talking past each other? > > > > > > > Without any magic, merely attempting to return the wrapper would cause > > it to collapse to the underlying object (by ca

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Chris Angelico
On Fri, Jun 28, 2019 at 6:17 AM Ricky Teachey wrote: > > I apologize in advance that this might be slightly off topic from the thread. > The idea I want to put forth is probably half baked, but I am wondering if > Nate's implementation might be adjusted to incorporate it, and if it might > solv

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Steven D'Aprano
On Fri, Jun 28, 2019 at 03:59:14AM +1000, Chris Angelico wrote: > > Are we talking past each other? > > > > Without any magic, merely attempting to return the wrapper would cause > it to collapse to the underlying object (by calling getself). Yeah, definitely talking past each other. Let's get

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Ricky Teachey
I apologize in advance that this might be slightly off topic from the thread. The idea I want to put forth is probably half baked, but I am wondering if Nate's implementation might be adjusted to incorporate it, and if it might solve a few of the objections. Hopefully someone hasn't already sugges

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-27 Thread Steven D'Aprano
On Thu, Jun 27, 2019 at 12:23:24PM -0400, nate lust wrote: > If you have a > bench mark you prefer I would be happy to run it against my changes and > mainline python 3.7 to see how they compare. Ultimately it will probably need to run against this: https://github.com/python/pyperformance for 3

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Chris Angelico
On Fri, Jun 28, 2019 at 3:55 AM Steven D'Aprano wrote: > > On Fri, Jun 28, 2019 at 02:44:28AM +1000, Chris Angelico wrote: > > > If it's ALWAYS called, then it's almost useless. The wrapper object > > will vanish the moment you attempt to do anything with it, devolving > > instantly to the result

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Steven D'Aprano
On Fri, Jun 28, 2019 at 02:44:28AM +1000, Chris Angelico wrote: > If it's ALWAYS called, then it's almost useless. The wrapper object > will vanish the moment you attempt to do anything with it, devolving > instantly to the result of getself. I don't understand why it is useless. If the wrapper o

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Steven D'Aprano
On Thu, Jun 27, 2019 at 12:02:38PM -0400, David Mertz wrote: > Moreover, this new magic is entirely needless. Properties already 100% > cover the plausible need. I've been using Python since version 1.5 and I'm yet to learn a way to prevent re-binding of a simple (undotted) name: x = 1 # okay

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread David Mertz
It's always pretty easy to turn it into "code you control." Just take whatever the plan value/object is and wrapped it in a class with a '._value' attribute that holds the original. From there, as as many properties as you like, each of which had whatever side effects you wish. That side effect mig

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread David Mertz
The variables (names) 'f' and 'g' are reused every time the loop iterates. You are correct that doing an explicit 'del' within the loop would presumably prevent the magic mutation-not-binding behavior under discussion. I still don't want the behavior, but I admit that's a pretty easy way to be mor

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-27 Thread nate lust
Steven, You may have seen the message I posted a little while ago detailing a bit more about the proposed changes with an example of how the interpreter will handle things like __getself__. I have working code here; https://github.com/natelust/cpython/tree/cloakingVars. I worked very hard to keep a

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread nate lust
That is true when it is code that you control, but if it is the case you want to use some specialized metavar in the context of someone else's library things are a bit different. This could be something such as using something like a debugger tracing through some execution where you want to record

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Steven D'Aprano
On Thu, Jun 27, 2019 at 11:39:04PM +1000, Chris Angelico wrote: > On Thu, Jun 27, 2019 at 11:11 PM Steven D'Aprano wrote: > > I'm not convinced that this is going to change under the proposal. Since > > neither f nor s already exist, they cannot overload assignment. Unless > > something in Nate's

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Chris Angelico
On Fri, Jun 28, 2019 at 1:59 AM nate lust wrote: > d = a + b + c > print(d) > > tmp = a + b > d = getcloaked(tmp) + c > prtint(d) > > Now the behavior is the same as the first case, as getcloaked returns the > metavariable that has not been bound > to a name and so it is loaded right on the stack

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread David Mertz
Obviously many kinds of errors are possible in existing Python. My quick sample made one by passing 'data' rather than my intended 'datum'. As you mention, maybe 'process_the()' will return the wrong kind of object some or all of the time. Mostly I would expect subsequent code to throw a ValueErro

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread nate lust
There seems to be some confusion to what is going on with the __getself__ method. This is almost certainly dues to my lack of communicating things clearly. I am going to attempt to walk through what will happen in context of a code example. The important thing to keep in mind is that __getself__ is

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Steven D'Aprano
On Thu, Jun 27, 2019 at 09:55:53AM -0400, David Mertz wrote: > On Thu, Jun 27, 2019 at 9:13 AM Steven D'Aprano wrote: > > > The only risk here is if your refactoring does something silly, such as > > reusing a variable which overrides assignment: > > How would you propose to write this code with

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread nate lust
I addressed some of the concerns you were responding to in the long email I wrote last night. I introduced a change to address this, see previous email for more details. On Thu, Jun 27, 2019 at 9:41 AM Chris Angelico wrote: > On Thu, Jun 27, 2019 at 11:11 PM Steven D'Aprano > wrote: > > > > On

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread nate lust
I think in this case, it would depend on what the metavar is designed to do. If f was a metavar that took in a value, had side effects, and then presented the variable back on load (that would be the __getself__ part of the proposal) I also included built ins for working with this type of variable,

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread David Mertz
On Thu, Jun 27, 2019 at 9:13 AM Steven D'Aprano wrote: > The only risk here is if your refactoring does something silly, such as > reusing a variable which overrides assignment: > How would you propose to write this code without reusing a variable? def frobnicate(data): stuff = [] for d

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Chris Angelico
On Thu, Jun 27, 2019 at 11:11 PM Steven D'Aprano wrote: > > On Thu, Jun 27, 2019 at 12:46:58AM +1000, Chris Angelico wrote: > > > There are many things that can be implemented with dunders, yes, but > > in Python, I would expect these two functions to behave identically: > > > > def f1(x): > >

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Steven D'Aprano
On Thu, Jun 27, 2019 at 12:46:58AM +1000, Chris Angelico wrote: > There are many things that can be implemented with dunders, yes, but > in Python, I would expect these two functions to behave identically: > > def f1(x): > return frob(x).spam > > def f2(x): > f = frob(x) > s = f.spam

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Rhodri James
On 27/06/2019 04:57, nate lust wrote: However it is a fair point, that it might not be transparent and you could end up with an exception thrown at some point. I would argue this is not much different than using any library code where you would need to understand the api, but documentation is not

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-27 Thread Steven D'Aprano
On Tue, Jun 25, 2019 at 03:34:03PM -0700, Ben Rudiak-Gould wrote: > On Tue, Jun 25, 2019 at 2:11 PM nate lust wrote: > >if an instance is bound to a variable name, any attempts to rebind > >that name will result in a call to the __setself__ (name negotiable) > >of the instance already bound to t

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
On Jun 26, 2019, at 21:45, Stephen J. Turnbull wrote: > > Chris Angelico writes: > >> Then I completely don't understand getself. Can you give an example >> of how it would be used? So far, it just seems like an utter total >> mess. > > It's possible that __getself__ would be implemented "half

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Stephen J. Turnbull
Chris Angelico writes: > Then I completely don't understand getself. Can you give an example > of how it would be used? So far, it just seems like an utter total > mess. It's possible that __getself__ would be implemented "halfway". That is, if __getself__ is present, it is invoked, and perfo

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread nate lust
:Hello all, I am sorry to send this out to the list and then be so silent, work and children and all. I am going to try and address the issues raised in this thread, with apologies if I miss someones issue. Some of these are addressed in the documentation I wrote, but I know I can't expect people t

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Brendan Barnwell
On 2019-06-26 14:27, nate lust wrote: This is the example I was talking about specifically: https://github.com/natelust/CloakingVarWriteup/blob/master/examples.py#L76. There are other possibilities as well, I would be happy to explain my Ideas directly, I am not sure exactly everything Yanghao is

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
On Jun 26, 2019, at 15:46, Greg Ewing wrote: > > Yes, but it's pretty universal across languages with name-binding > semantics for assignment (Lisp, Ruby, Javascript etc.) that assigning > to a local name doesn't invoke any magic. I don’t think that’s quite true. Many languages with name-bindin

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Greg Ewing
Yanghao Hua wrote: when you do x.y = z and if y is a descriptor you don't expect x.y is now pointing/binding to z, you have to understand the object behavior anyway. I do not see how this is different in the set/getself() case. The difference is that the special behaviour is associated with 'x.

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Greg Ewing
Anders Hovmöller wrote: On 26 Jun 2019, at 16:46, Chris Angelico wrote: it violates programmer expectations *across many languages* regarding refactoring. isn't that potentially extremely different in C++ for example? Yes, but it's pretty universal across languages with name-binding seman

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
On Jun 26, 2019, at 13:53, Chris Angelico wrote: > Then in what circumstances will getself NOT be called? What is the > point of having an object, if literally every reference to it will > result in something else being used? I think Yanghao has misunderstood the proposal. What Nate actually pro

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
On Wednesday, June 26, 2019, 11:53:30 AM PDT, Chris Angelico wrote: > I don't think you can define what "f->spam" means Well, you can, but only the first half of what it means, so I don't think this changes your point. If f is a pointer, then f->spam means to dereference the pointer f, then a

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Yanghao Hua
On Wed, Jun 26, 2019 at 11:24 PM nate lust wrote: [...] > Yanhao, I do not think you are doing this proposal any good. I appreciate you > trying to go to bat for it, but there are many good concerns here that would > be good to hear out and address rather than trying to dismiss them. I was tryi

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Yanghao Hua
On Wed, Jun 26, 2019 at 11:16 PM Chris Angelico wrote: [...] > Then I completely don't understand getself. Can you give an example of > how it would be used? So far, it just seems like an utter total mess. Sure, below is my code snippet for signal get/set, using "L[:] = thing" syntax and overridi

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread nate lust
This is the example I was talking about specifically: https://github.com/natelust/CloakingVarWriteup/blob/master/examples.py#L76. There are other possibilities as well, I would be happy to explain my Ideas directly, I am not sure exactly everything Yanghao is saying as I have not been able to follo

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread nate lust
Chris, There are a lot of messages for me to catch up on from today, but I am heading home from work, and your most recent one is the easiest to address quickly. I want to start out by saying I agree with many of the objections and concerns raised here, and there were some I had not thought about.

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Chris Angelico
On Thu, Jun 27, 2019 at 7:11 AM Yanghao Hua wrote: > > On Wed, Jun 26, 2019 at 11:00 PM Chris Angelico wrote: > > > > On Thu, Jun 27, 2019 at 6:50 AM Yanghao Hua wrote: > > > > > > On Wed, Jun 26, 2019 at 10:16 PM Chris Angelico wrote: > > > > > > > > Let's suppose that frob() returns something

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Yanghao Hua
On Wed, Jun 26, 2019 at 11:00 PM Chris Angelico wrote: > > On Thu, Jun 27, 2019 at 6:50 AM Yanghao Hua wrote: > > > > On Wed, Jun 26, 2019 at 10:16 PM Chris Angelico wrote: > > > > > > Let's suppose that frob() returns something that has a __getself__ > > > method. Will f1 trigger its call? Will

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Chris Angelico
On Thu, Jun 27, 2019 at 6:50 AM Yanghao Hua wrote: > > On Wed, Jun 26, 2019 at 10:16 PM Chris Angelico wrote: > > > > Let's suppose that frob() returns something that has a __getself__ > > method. Will f1 trigger its call? Will f2? If the answer is "yes" to > > both, then when ISN'T getself calle

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
On Jun 26, 2019, at 07:34, Anders Hovmöller wrote: > > I 100% agree that this proposal is a bad idea. But I do have to play Devils > advocate here. > > The the-code-is-understandable-at-face-value ship has already sailed. + > doesn't mean add, it means calling a dunder function that can do an

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Yanghao Hua
On Wed, Jun 26, 2019 at 10:16 PM Chris Angelico wrote: > > On Thu, Jun 27, 2019 at 5:29 AM Yanghao Hua wrote: > > > > On Wed, Jun 26, 2019 at 4:47 PM Chris Angelico wrote: > > [...] > > > There are many things that can be implemented with dunders, yes, but > > > in Python, I would expect these t

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Ethan Furman
On 06/26/2019 07:34 AM, Anders Hovmöller wrote: I 100% agree that this proposal is a bad idea. But I do have to play Devils advocate here. The the-code-is-understandable-at-face-value ship has already sailed. + doesn't mean add, it means calling a dunder function that can do anything. True,

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Chris Angelico
On Thu, Jun 27, 2019 at 5:29 AM Yanghao Hua wrote: > > On Wed, Jun 26, 2019 at 4:47 PM Chris Angelico wrote: > [...] > > There are many things that can be implemented with dunders, yes, but > > in Python, I would expect these two functions to behave identically: > > > > def f1(x): > > return

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Yanghao Hua
On Wed, Jun 26, 2019 at 4:47 PM Chris Angelico wrote: [...] > There are many things that can be implemented with dunders, yes, but > in Python, I would expect these two functions to behave identically: > > def f1(x): > return frob(x).spam > > def f2(x): > f = frob(x) > s = f.spam >

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Chris Angelico
On Thu, Jun 27, 2019 at 1:41 AM Anders Hovmöller wrote: > > On 26 Jun 2019, at 16:46, Chris Angelico wrote: > > There are many things that can be implemented with dunders, yes, but > > in Python, I would expect these two functions to behave identically: > > > > def f1(x): > >return frob(x).sp

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-26 Thread nate lust
Stephen, Thanks for the reply, it is a busy day at work today, so it is going to take me a little bit of time to sit down and really process all you have said. I wanted to drop you a message though and link you to the examples that I mentioned. https://github.com/natelust/CloakingVarWriteup/blob/ma

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Anders Hovmöller
> On 26 Jun 2019, at 16:46, Chris Angelico wrote: > >> On Thu, Jun 27, 2019 at 12:37 AM Anders Hovmöller >> wrote: >> On 26 Jun 2019, at 14:28, Rhodri James wrote: On 26/06/2019 08:34, Yanghao Hua wrote: I find the objection reasoning very strange as none of the default

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Chris Angelico
On Thu, Jun 27, 2019 at 12:37 AM Anders Hovmöller wrote: > > > On 26 Jun 2019, at 14:28, Rhodri James wrote: > > > >> On 26/06/2019 08:34, Yanghao Hua wrote: > >> I find the objection reasoning very strange as none of the default > >> behavior changed, and yet if you use this feature you do need

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Anders Hovmöller
> On 26 Jun 2019, at 14:28, Rhodri James wrote: > >> On 26/06/2019 08:34, Yanghao Hua wrote: >> I find the objection reasoning very strange as none of the default >> behavior changed, and yet if you use this feature you do need to worry >> about the object behavior regarding assignment, this i

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Rhodri James
On 26/06/2019 08:34, Yanghao Hua wrote: I find the objection reasoning very strange as none of the default behavior changed, and yet if you use this feature you do need to worry about the object behavior regarding assignment, this is true for descriptors and all other magics. The problem is not

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-26 Thread Yanghao Hua
On Tue, Jun 25, 2019 at 11:01 PM nate lust wrote: > > This message is related to two previous threads, but was a sufficiently > evolved to warrant a new topic. > > I am proposing that two new magic methods be added to python that will > control assignment and loading of class > instances. This m

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread nate lust
Steven, I apologize I was unaware that this was not the best suggestion, and had already created a topic. I can close it out if that would be best. On Tue, Jun 25, 2019 at 10:25 PM Steven D'Aprano wrote: > On Tue, Jun 25, 2019 at 06:35:48PM -0400, Juancarlo Añez wrote: > > > Is there any chance

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread Steven D'Aprano
On Tue, Jun 25, 2019 at 06:35:48PM -0400, Juancarlo Añez wrote: > Is there any chance you'll want to move the discussion to the richer > context here? https://discuss.python.org/c/ideas Please don't. -- Steven ___ Python-ideas mailing list -- python-

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread nate lust
I created a discussion topic located here https://discuss.python.org/t/a-proposal-and-implementation-to-add-assignment-and-load-overloading/1905 On Tue, Jun 25, 2019 at 6:41 PM nate lust wrote: > I am happy to move this discussion to where ever is appropriate. I won't > get to it in the next few

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread nate lust
I tried to address most of the above in the more detailed write-up I linked to. I didn't want to spam out a message that was too long, and the link provided a good way to get syntax highlighting etc. The code that is available in the linked github repository now treats lookups and sets in fastloca

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread Andrew Barnert via Python-ideas
On Jun 25, 2019, at 14:00, nate lust wrote: > > This message is related to two previous threads, but was a sufficiently > evolved to warrant a new topic. > > I am proposing that two new magic methods be added to python that will > control assignment and loading of class > instances. This means

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread nate lust
I am happy to move this discussion to where ever is appropriate. I won't get to it in the next few hours (bed time for my kid) so if you would like feel free to move discussion there, and I guess I can watch this email thread for if you do. Otherwise I will do it when I am free. Nate On Tue, Jun 2

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread Juancarlo Añez
Nate, I find this mightily interesting! I think it's worth discussing at length. Is there any chance you'll want to move the discussion to the richer context here? https://discuss.python.org/c/ideas Regards, On Tue, Jun 25, 2019 at 5:00 PM nate lust wrote: > This message is related to two pre

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread Ben Rudiak-Gould
On Tue, Jun 25, 2019 at 2:11 PM nate lust wrote: >if an instance is bound to a variable name, any attempts to rebind that name >will result in a call to the __setself__ (name negotiable) of the instance >already bound to that name. I am very, very strongly opposed to this. It would mean that I