Re: [Python-ideas] A proper way to bring real interfaces to Python

2019-05-08 Thread Serge Matveenko
On Tue, May 7, 2019 at 2:45 AM Steven D'Aprano wrote: > > On Sun, May 05, 2019 at 04:23:58AM +0300, Serge Matveenko wrote: > > > So, I would like to propose adding a third main object called > > `interface` in addition to `object` and `type` and to use it to define > > interface objects. > > Havin

Re: [Python-ideas] A proper way to bring real interfaces to Python

2019-05-08 Thread Chris Angelico
On Wed, May 8, 2019 at 7:30 PM Serge Matveenko wrote: > > On Tue, May 7, 2019 at 2:45 AM Steven D'Aprano wrote: > > > > On Sun, May 05, 2019 at 04:23:58AM +0300, Serge Matveenko wrote: > > > > > So, I would like to propose adding a third main object called > > > `interface` in addition to `object

Re: [Python-ideas] A proper way to bring real interfaces to Python

2019-05-08 Thread Serge Matveenko
On Wed, May 8, 2019 at 12:37 PM Chris Angelico wrote: > When you come to write it up, I hope you can go into some detail about > what you mean by "a third main object". Currently, the hierarchy is > reentrant at the apex ("object" is an instance of "type", and "type" > is a subclass of "object");

[Python-ideas] Specific equality method for hashable objects

2019-05-08 Thread Phillip Cloud
A number of libraries override the equality operator (__eq__) in such a way that it returns an object that isn't a Python bool. This all but precludes making these objects hashable, even though there's nothing in principle that prevents them from being so. The main use case I have in mind is an ex

Re: [Python-ideas] Specific equality method for hashable objects

2019-05-08 Thread Brett Cannon
This goes against "there's only one way to do it" and overriding equality and hashing is niche enough that I don't think it warrants having two ways of doing it (because you can't drop overriding __eq__/__hash__ due to backwards-compatibility concerns). On Wed, May 8, 2019 at 9:50 AM Phillip Clou

Re: [Python-ideas] Trigonometry in degrees

2019-05-08 Thread Kyle Lahnakoski
Maybe a library of trig functions that include an Angle type? This is related to the timespan units discussion we just had def sin(angle): On 2018-06-08 01:44, Yuval Greenfield wrote: > On Thu, Jun 7, 2018 at 10:38 PM Stephen J. Turnbull > > wrote:

Re: [Python-ideas] More alternate constructors for builtin type

2019-05-08 Thread Christopher Barker
On Tue, May 7, 2019 at 11:43 AM Ricky Teachey wrote: > def eat_iterable(yummy_iterable): > if isinstance(yummy_iterable, str): > raise TypeError("BLECH! Strings are ATOMIC in this context, > mmkay??") > tasty_list = list(yummy_iterable) > # digest list... > > The design decisi