Re: [Python-Dev] Possible undefined behavior on creating a method named "__dict__"

2018-04-11 Thread Guido van Rossum
On Wed, Apr 11, 2018 at 5:08 AM, Steven D'Aprano wrote: > On Wed, Apr 11, 2018 at 08:21:01AM -0300, Joao S. O. Bueno wrote: > > I just came across a code snippet that > > would define a method with the "__dict__" name - like in: > > > > class A: > > def __dict__(self): > > return ()

Re: [Python-Dev] Possible undefined behavior on creating a method named "__dict__"

2018-04-11 Thread Brett Cannon
On Wed, 11 Apr 2018 at 05:09 Steven D'Aprano wrote: > On Wed, Apr 11, 2018 at 08:21:01AM -0300, Joao S. O. Bueno wrote: > > I just came across a code snippet that > > would define a method with the "__dict__" name - like in: > > > > class A: > > def __dict__(self): > > return () > >

Re: [Python-Dev] Possible undefined behavior on creating a method named "__dict__"

2018-04-11 Thread Steven D'Aprano
On Wed, Apr 11, 2018 at 08:21:01AM -0300, Joao S. O. Bueno wrote: > I just came across a code snippet that > would define a method with the "__dict__" name - like in: > > class A: > def __dict__(self): > return () That's a strange thing to do, but I don't think it ought to be illega