[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2020-12-18 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2020-12-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 782665885c983e88aac12f7e082485cac2df8007 by Miss Islington (bot) in branch '3.9': bpo-34805: Guarantee that __subclasses__() is in definition order. (GH-23844) (GH-23850)

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2020-12-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 51f4688254ebb7b30215de424360ba5c92c63fe8 by Raymond Hettinger in branch 'master': bpo-34805: Guarantee that __subclasses__() is in definition order. (GH-23844)

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2020-12-18 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 7.0 -> 8.0 pull_requests: +22714 pull_request: https://github.com/python/cpython/pull/23850 ___ Python tracker

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2020-12-18 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +22705 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/23844 ___ Python tracker

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-09-13 Thread Pekka Klärck
Pekka Klärck added the comment: First of all, thanks Raymond for the revival. Secondly, I agree with Josh that there are better ways to handle my original use case (e.g. `functools.singledispatch`) but `__subclasses__()` preserving the definition order could nevertheless be useful in other

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-09-13 Thread Guido van Rossum
Guido van Rossum added the comment: It's just a small doc change right? I'd just makle a PR and see if Raymond accepts it. -- ___ Python tracker ___

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-09-13 Thread Luna Chen
Luna Chen added the comment: Yes I am! :) Should I start looking into this? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-09-13 Thread Guido van Rossum
Guido van Rossum added the comment: Thank you Raymond. Luna, are you still interested? -- ___ Python tracker ___ ___

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-09-13 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-09-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: If there are no objections, I would like to revive this. All we need to do is add a one-line guarantee to the docs and a test to back it up. Except for the aberration on Py3.5, add_subclass() tracks new subclasses in the order created. This behavior is

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2019-04-11 Thread Cheryl Sabella
Change by Cheryl Sabella : -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-07 Thread Guido van Rossum
Guido van Rossum added the comment: OK, I don't have time to keep arguing, and I doubt any other core devs care. We should probably just close it as Won't Fix, since it's not important enough to keep deliberating. Luna, I recommend that you pick another project. --

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Keep in mind, had this guarantee been in place in 3.4, the improvement in 3.5 couldn't have been made, and issue17936 might have been closed and never addressed, even once dicts were ordered, simply because we never rechecked it. It makes the whole

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: I wrote the response to the OP's use case before I saw your response; it wasn't really intended as an additional critique of the proposed change or a counterargument to your post, just a note that the required behavior could be obtained on all versions of

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-07 Thread Guido van Rossum
Guido van Rossum added the comment: Josh, I have to ask -- do you have plans to rewrite the __subclasses__ implementation? Because at this point I don't really feel like arguing over the OP's use case. It looks like you have a strong objection over the requested feature that's quite

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'm also a little skeptical of the OP's proposed use case for other reasons. In any circumstance other than "all classes are defined in the same module", you can't really make useful guarantees about subclass definition order, because: 1. If the converters

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-07 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks for the long post! Clearly there is more here than the eye can easily see. Nevertheless, I feel that, *in this case*, it's not likely that such a re-implementation will ever happen, so I think it is okay to constrain the future so we can guarantee

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: First off, the OP's original case seems like a use case for functools.singledispatch. Not really related to the problem, just thought I'd mention it. Secondly, are we sure we want to make such a guarantee? That restricts the underlying storage to ordered

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Guido van Rossum
Guido van Rossum added the comment: Since this is how it works since 3.6, I think it's reasonable to make this part of the spec. For dictionary order we waited a release between implementing it that way and making it part of the spec; effectively we've already waited two releases (3.6 and

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I would kindly suggest waiting until there is some consensus on this before doing any Pull Request. -- ___ Python tracker ___

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Pekka Klärck
Pekka Klärck added the comment: Haven't created a PR yet. Go ahead and great one if you have time Luna! We'd need a decision about this too, but if the decision is no, then it would nevertheless be a good idea to mention in the docs that the order is not guaranteed. --

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Luna Chen
Luna Chen added the comment: Hi Pekka Klärck, I would like to work on this issue and make a PR if you haven't done it yet. Thanks!:) -- nosy: +BNMetrics ___ Python tracker

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-10-16 Thread Pekka Klärck
Pekka Klärck added the comment: My use case was implementing conversion of strings to different objects based on type information got from function arguments. Initially I had a converter class with methods for each conversion (e.g. `_convert_bool`, `_convert_int`) but this class got so big

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-10-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Hi and thank you for the proposal. Could you detail a bit more about your use-case? Thanks -- nosy: +pablogsal ___ Python tracker

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-09-26 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-09-26 Thread Pekka Klärck
New submission from Pekka Klärck : I had a use case where `MyClass.__subclasses__()` returning classes in the definition order would have made the code simpler. They seemed to be returned in that order, but because the docs didn't say anything about it [1] I did some searching to find out can