On Friday, 23 October 2020 07:36:39 UTC+2, Greg Ewing wrote: > On 23/10/20 2:13 pm, Julio Di Egidio wrote: > > I am now thinking whether I could achieve the "standard" > > behaviour via another approach, say with decorators, somehow > > intercepting calls to __new__... maybe. > > I'm inclined to step back and ask -- why do you care about this? > > Would it actually do any harm if someone instantiated your > base class? If not, then it's probably not worth going out > of your way to prevent it.
This is the first little library I try to put together in Python, and it was natural for me to hit it with all the relevant decorations as well as type annotations in order to expose *strict* contracts, plus hopefully have intellisense work all over the place. After several days of struggling, I am indeed finding that impossible in Python, at least with the available tools, and I am indeed going out of my way to just get some half-decent results... But, if I give up on strict contracts, I can as well give up on type annotations and the whole lot, indeed why even subclass ABC? Which is maybe too drastic, maybe not: it's the next thing I am going to try, and see what I remain with. :) Of course, any more hints welcome... Julio -- https://mail.python.org/mailman/listinfo/python-list