Antoine Rozo writes:
> If the only feature you need from super is the proxy one, why don't you
> code your own parent-proxy-type?

I did : 
https://github.com/malmiteria/super-alternative-to-super/blob/master/parent.py

This is irrelevant to the discussion we're having i think.
Essentially, I'm arguing against today's state of some edge case of MRO + 
super, and against the UX associated with it.
Those are issues with today's python, and the update that i propose would 
reduce the UX problems with super and MRO, would allow for use case of super 
more in line with the expectation of the majority, and would open the door to a 
few cases locked behind MRO errors today.
Technically, with my proposal, you could even do circular inheritance, which is 
definitely unheard of today:
```
class Day:
  def tell_time(self):
    print("it's daytime")
    sleep(10000)
    super().tell_time()

class Night(Day):
  def tell_time(self):
    print("it's night time")
    sleep(10000)
    super().tell_time()

Day.__bases__ = (Night, )

Day().tell_time() # infinitely loops over "it's daytime" and "it's night time"
```
That would be an incredibely easy way to articulate process that repeat in a 
cycle, with no end, cron style.
No need to get multiple class too:
```
class CronTask:
  def task(self):
    # do something
    time.sleep(10000)
    super().task()

CronTask.__bases__ = (CronTask, )

CronTask().task() # runs the task forever with a time sleep in between
```

I'm convinced there's some smart designs that are banned from python because of 
MRO and super's limitations.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/BKFSLLICTCAYBPIZBTVW4Y4OPT3UKBZ2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to