On Wed, Aug 29, 2018 at 05:52:46PM +1200, Greg Ewing wrote: > Wes Turner wrote: > > I'm going to re-write that in a pseudo-Eiffel like syntax: > > Maybe some magic could be done to make this work: > > def __init__(self, img: np.ndarray, x: int, y: int, width: int, > height: int) -> None: > > def __require__():
The problem with this idea is that methods and functions are not declarations, but executable code. This __require__ function doesn't exist except while the __init__ method is running. So it can't be called before the __init__, it can't be called *automatically* (you need to call it yourself, from inside the __init__), and it can't be inherited. Of course with sufficient compiler magic of course the compiler could special case these methods and do whatever we want, but that seems like it would be just as much work but much uglier than using dedicated syntax. -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/