Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-11 Thread Chris Angelico
On Sun, Feb 12, 2017 at 3:38 PM, Steven D'Aprano wrote: > On Sat, Feb 11, 2017 at 06:33:39PM +1300, Greg Ewing wrote: >> Chris Angelico wrote: >> >Which is why these proposals always seem to gravitate to "anything you >> >can assign to", >> >> There might be some parsing

Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-11 Thread Steven D'Aprano
On Sat, Feb 11, 2017 at 06:33:39PM +1300, Greg Ewing wrote: > Chris Angelico wrote: > >Which is why these proposals always seem to gravitate to "anything you > >can assign to", > > There might be some parsing difficulties with that, e.g. > >def foo(x)[5](y, z): > ... > > That should

Re: [Python-ideas] Fwd: Define a method or function attributeoutsideof a class with the dot operator

2017-02-11 Thread Steven D'Aprano
On Fri, Feb 10, 2017 at 12:11:46PM -0600, Steve Dower wrote: > When you apply the "what if everyone did this" rule, it looks like a > bad idea (or alternatively, what if two people who weren't expecting > anyone else to do this did it). When you apply that rule, Python generally fails badly.

Re: [Python-ideas] Fwd: Define a method or function attributeoutside of a class with the dot operator

2017-02-11 Thread Steven D'Aprano
On Fri, Feb 10, 2017 at 06:17:54PM +0200, Markus Meskanen wrote: > Well yes, but I think you're a bit too fast on labeling it a mistake to use > monkey patching... More importantly, I think we're being a bit too quick to label this technique "monkey-patching" at all. Monkey-patching (or MP for

Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-11 Thread Random832
On Sat, Feb 11, 2017, at 00:33, Greg Ewing wrote: > Chris Angelico wrote: > > Which is why these proposals always seem to gravitate to "anything you > > can assign to", > > There might be some parsing difficulties with that, e.g. > > def foo(x)[5](y, z): >... > > That should be

Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-11 Thread Greg Ewing
Chris Angelico wrote: Which is why these proposals always seem to gravitate to "anything you can assign to", There might be some parsing difficulties with that, e.g. def foo(x)[5](y, z): ... That should be acceptable, because foo(x)[5] is something assignable, but foo(x) looks like