[issue27561] Warn against subclassing builtins, and overriding their methods

2019-08-22 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: Will do. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-22 Thread Chris Rebert
Changes by Chris Rebert : -- nosy: +cvrebert ___ Python tracker ___ ___

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-19 Thread Kirk Hansen
Kirk Hansen added the comment: Raymond: Thanks for essentially answering my stackoverflow question (if you are a member, and add most of your response, I'll accept it). I agree enough with your documentation statement. An entry in an FAQ would have been just as helpful to me as a note in the

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: Raymond, that was a fantastic explanation. Would you be willing to turn it into a FAQ? Or if you don't have the time, to allow somebody to steal your description and use it? -- nosy: +steven.daprano ___ Python

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-18 Thread R. David Murray
R. David Murray added the comment: Raymond: yes, I was dubious about the benefit of the doc note. -- ___ Python tracker ___

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is an example of the open-closed-principle (the class is open for extension but closed for modification). It is good thing to have because it allows subclassers to extend or override a method without unintentionally triggering behavior changes in

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-18 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- priority: normal -> low ___ Python tracker ___

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-18 Thread R. David Murray
R. David Murray added the comment: It doesn't just apply to dicts, it applies to all the built in collection types (and possibly to other built in types). But not to all the methods, which will make the documentation somewhat vague ("you may not be able to successfully override base class

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-18 Thread Kirk Hansen
Kirk Hansen added the comment: I think it could make sense at the top of the intro. It could also make sense to have it sit https://docs.python.org/2.7/library/stdtypes.html?highlight=dict#mapping-types-dict and have the intro link to it, or vice-versa. Thoughts? --

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-18 Thread R. David Murray
R. David Murray added the comment: Where in the docs do you think such a note should go? I suppose it could go in the intro to the chapter you link to. I doubt many people will find it there, though :( -- nosy: +r.david.murray versions: -Python 3.2, Python 3.3, Python 3.4

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-18 Thread Kirk Hansen
New submission from Kirk Hansen: I tried subclassing dict, and overriding its __setitem__ and __getitem__ and got some interesting results. See http://stackoverflow.com/questions/38362420/subclassing-dict-dict-update-returns-incorrrect-value-python-bug?noredirect=1#comment64142710_38362420