[Python-ideas] Re: Lists create

2019-06-21 Thread Jeff Allen
This list is for people who have ideas how to improve Python, not for those looking for help learning it. There's such a lot of help online, it's hard to know where to send you. This gives the answer to your question: https://www.learnpython.org/en/Lists . This seems like a good list of place

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread Yanghao Hua
On Thu, Jun 20, 2019 at 10:28 PM nate lust wrote: > > There is nothing more humbling than sending nonsense out to an entire mailing > list. It will teach me to stop an process my steam of consciousness > critically instead of just firing off a message. You were right that I was > not at all con

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread Ethan Furman
On 06/20/2019 01:25 PM, nate lust wrote: --> class Foo: ... def __init__(self, o): ...         self.o = o ...     def __setself__(self, v): ...         self.v = v ... --> f = Foo(5) --> print(f) <__main__.Foo object at 0x7f486bb8d300> --> print(f.o) 5 >>> print(f.v) Tr

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread Andrew Barnert via Python-ideas
On Jun 20, 2019, at 13:25, nate lust wrote: > > There is nothing more humbling than sending nonsense out to an entire mailing > list. You’re something like the 300th person to suggest overloading assignment, but the only one of that 300 willing to think it through, much less create a patch. T

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread nate lust
I think it is only surprising because it is not something that is familiar. It's not like python python doesn't already have other assignment with different behaviors, for instance: a = "hello world" a = 6 print(a) -> 6 class Foo: @property def x(self): return self._internal @x

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread nate lust
You are right that there are many things to consider, and I too don't know what the right answer is. I was more interested in the challenge of doing it. Like I said this is only a demo, and would probably need consideration of things like this. I had thought of the dict/list thing, and as you say i

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread Andrew Barnert via Python-ideas
On Jun 21, 2019, at 14:36, nate lust wrote: > > I think it is only surprising because it is not something that is familiar. Part of the problem may be that in your toy example, there really is no reason to overload assignment, so it’s surprising even after you get what it’s doing. If you worke

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread nate lust
I will think about more interesting examples weekend, though my time will probably be more family focused so I might not get any messages of appreciable length out until sometime next week. I do get what you are saying on the const vs immutability thing, but I was thinking that because python work

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread Chris Angelico
On Sat, Jun 22, 2019 at 11:19 AM nate lust wrote: > Typing this out though does make me think of an interesting idea. If there > was something like __getself__ in addition to __setself__, you could > implement things like MyInt. __getself__ would look something like: > > class MyInt: > def _

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread nate lust
It probably doesn't, this was just something I typed up on the fly, so is unlikely the end result would be what you see above if it was actually implemented. The only way around that that I can think of now would be if there was two functions, an impl_dictget that actually did the lookup that type