This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients gvanrossum, maggyero, rhettinger
Date 2022-03-26.01:42:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648258940.71.0.165926621328.issue44090@roundup.psfhosted.org>
In-reply-to
Content
Guido, what do you think about this proposal?  

Personally, I'm dubious about changing the meaning of the arguments between code paths.  The callee has no way to distinguish which meaning was intended.  And adding classmethod() support in super_descr_get() would create tight coupling where there should be separate concerns (no other descriptor call is classmethod specific).  

On StackOverflow, there has been some mild interest in the interactions between super() and classmethod():

* https://stackoverflow.com/questions/64637174
* https://stackoverflow.com/questions/1269217
* https://stackoverflow.com/questions/1817183

The OP's proposed use case is mildly plausible though I've never seen it the arise in practice.  The GoF factory pattern is typically implemented in a function rather than in the class itself — for example the open() function returns one of two different classes depending on the text or binary file mode.  It is rare to see __new__ used to fork off different types based on a parameter.  Presumably, it would be even more rare with a classmethod.  Also, it's not clear that the GoF pattern would mesh well with our cooperative super() since the upstream parent class isn't known in advance.
History
Date User Action Args
2022-03-26 01:42:20rhettingersetrecipients: + rhettinger, gvanrossum, maggyero
2022-03-26 01:42:20rhettingersetmessageid: <1648258940.71.0.165926621328.issue44090@roundup.psfhosted.org>
2022-03-26 01:42:20rhettingerlinkissue44090 messages
2022-03-26 01:42:20rhettingercreate