On Sat, 25 May 2013 15:26:58 +0200 Antoine Pitrou <solip...@pitrou.net> wrote:
> On Sat, 25 May 2013 06:23:56 -0700 > Eli Bendersky <eli...@gmail.com> wrote: > > On Sat, May 25, 2013 at 6:18 AM, Antoine Pitrou <solip...@pitrou.net> wrote: > > > > > > > > Hello, > > > > > > In http://bugs.python.org/issue17936, I proposed making tp_subclasses > > > (the internal container implementing object.__subclasses__) a dict. > > > This would make the return order of __subclasses__ completely > > > undefined, while it is right now slightly predictable. I have never seen > > > __subclasses__ actually used in production code, so I'm wondering > > > whether someone might be affected by such a change. > > > > > > Regards > > > > > > > Personally I never used it, but it's now explicitly documented as returning > > a list. Not sure what's the right thing to do here, but perhaps returning > > an OrderedDict can eliminate the order problem? > > It would still return a list. I guess I should explain myself more clearly: __subclasses__() already computes its result on-the-fly (it must weed out dead weakrefs) (*). So the visible behaviour of __subclasses__ wouldn't change, except for ordering. (*) >>> object.__subclasses__() is object.__subclasses__() False Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com