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
Anders Hovmöller writes:
> In python code basically can't be understood at face value.
Not really a problem. The #ToddlerInChief doesn't code; the rest of
us are adults and use code by consent. Obfuscate your code by
seriously violating the expections for the meaning of "+" or
".denominator"
: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
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
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
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
Please change the subject line when you change the topic of
conversation. Or even better, since this isn't strongly related to
what you're replying to, and you quoted no text whatsoever - just make
it a brand new post. Thanks!
On Thu, Jun 27, 2019 at 5:06 AM James Lu wrote:
>
> What if we had
On Jun 25, 2019, at 08:44, James Lu wrote:
>
> What if we had reverse format strings, i.e. reading formatted input?
>
> x = readf("{:.0%}", "50%")
> # => x == 0.50
> x = readf("{:.0}", "50")
> # => x == 0.50
>
> Readf takes the repr() of its second argument and “un-formats” the string.
What’s
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
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
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
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
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
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
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
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
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?
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
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
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
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.
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
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
>
What if we had reverse format strings, i.e. reading formatted input?
x = readf("{:.0%}", "50%")
# => x == 0.50
x = readf("{:.0}", "50")
# => x == 0.50
Readf takes the repr() of its second argument and “un-formats” the string.
___
Python-ideas mailing
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
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.
> 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
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
> 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
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
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
nate lust writes:
> On first read, that may be surprising, but it extends a behavior
> pattern that already exists for things like properties (and
> generically descriptors) to object instances themselves.
I don't think that's a correct interpretation. In all cases of
assignment, a name is
32 matches
Mail list logo