On Fri, Mar 20, 2020 at 3:28 PM Steven D'Aprano <st...@pearwood.info> wrote: > > On Fri, Mar 20, 2020 at 03:01:16PM +1100, Chris Angelico wrote: > > On Fri, Mar 20, 2020 at 2:59 PM Steven D'Aprano <st...@pearwood.info> wrote: > > > > > > On Thu, Mar 19, 2020 at 11:38:28PM +0000, Samuel Colvin wrote: > > > > > > > But it also looks for a "__pretty__" method on objects, and if found > > > > uses > > > > that to display the object. > > > > > > Are you aware that dunder names are reserved for Python's use? > > > > > > > Really? > > Yes, really. > > https://docs.python.org/3/reference/lexical_analysis.html#reserved-classes-of-identifiers > > > > Somebody better tell SQLAlchemy that they're breaking rules, then. > > Lots of people break the rules all the time. Doesn't mean they should. >
"Subject to breakage without warning" technically applies to a *lot* of things that aren't guaranteed. Using __pretty__ as a protocol is no different from any of those. IMO it's not exactly a serious crime, even if technically it's something that could be broken. Also, since this is a proposal on python-ideas, it'd have as much blessing as __copy__, which to my knowledge has no meaning in the language itself, only in the standard library; it'd be the same with __pretty__, defined by the pprint module. ChrisA _______________________________________________ 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/3MLV7SHVDEAUR3POUXZFULSLOJ6ZJFYV/ Code of Conduct: http://python.org/psf/codeofconduct/