Send Python-ideas mailing list submissions to
python-ideas@python.org
To subscribe or unsubscribe via the World Wide Web, visit
https://mail.python.org/mailman3/lists/python-ideas.python.org/
or, via email, send a message with subject or body 'help' to
python-ideas-request@python.org
You can reach the person managing the list at
python-ideas-owner@python.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Python-ideas digest..."Today's Topics:
1. Re: dunder methods for encoding & prettiness aware formal & informal
representations
(Chris Angelico)
2. Re: dunder methods for encoding & prettiness aware formal & informal
representations
(Steven D'Aprano)
3. Re: dunder methods for encoding & prettiness aware formal & informal
representations
(Greg Ewing)
4. Re: dunder methods for encoding & prettiness aware formal & informal
representations
(Steven D'Aprano)
---------- Forwarded message ----------
From: Chris Angelico <rosuav@gmail.com>
To: "Steven D'Aprano" <steve@pearwood.info>
Cc: python-ideas <python-ideas@python.org>
Bcc:
Date: Fri, 20 Mar 2020 15:37:08 +1100
Subject: [Python-ideas] Re: dunder methods for encoding & prettiness aware
formal & informal representations
On Fri, Mar 20, 2020 at 3:28 PM Steven D'Aprano <steve@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 <steve@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-o...
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
---------- Forwarded message ----------
From: "Steven D'Aprano" <steve@pearwood.info>
To: python-ideas@python.org
Cc:
Bcc:
Date: Fri, 20 Mar 2020 16:25:28 +1100
Subject: [Python-ideas] Re: dunder methods for encoding & prettiness aware
formal & informal representations
On Fri, Mar 20, 2020 at 03:37:08PM +1100, Chris Angelico wrote:
"Subject to breakage without warning" technically applies to a *lot*
of things that aren't guaranteed.
Yes?
Using __pretty__ as a protocol is no different from any of those.
If we should choose to use a `__pretty__` dunder, we have no obligation
to follow Samuel's API, or make it a future-import, or give him any
warning, or make any allowances for the fact that he is already using
it. We can just break his code.
Samuel may not have known that, but hopefully he will now.
IMO it's not exactly a serious crime,
Isn't it? Damn, I've already reported him to the federal police, the
SWAT team will be arriving in 5, 4, 3, 2, ...
*wink*
I didn't describe it as a crime at all, I just asked if he knew he was
using a reserved name.
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.
I don't think that's a distinction that means anything. Whether the
standard library or the interpreter itself breaks your code, it's still
broken.
--
Steven
---------- Forwarded message ----------
From: Greg Ewing <greg.ewing@canterbury.ac.nz>
To: python-ideas@python.org
Cc:
Bcc:
Date: Fri, 20 Mar 2020 18:30:24 +1300
Subject: [Python-ideas] Re: dunder methods for encoding & prettiness aware
formal & informal representations
On 20/03/20 4:55 pm, Steven D'Aprano wrote:
Are you aware that dunder names are reserved for Python's use?
Nobody is going to put you in jail if you use an unofficial dunder
name. You just run the risk that your use of it will conflict with
some official use in the future.
--
Greg
---------- Forwarded message ----------
From: "Steven D'Aprano" <steve@pearwood.info>
To: python-ideas@python.org
Cc:
Bcc:
Date: Fri, 20 Mar 2020 17:20:25 +1100
Subject: [Python-ideas] Re: dunder methods for encoding & prettiness aware
formal & informal representations
On Fri, Mar 20, 2020 at 06:30:24PM +1300, Greg Ewing wrote:
On 20/03/20 4:55 pm, Steven D'Aprano wrote:
Are you aware that dunder names are reserved for Python's use?
Nobody is going to put you in jail if you use an unofficial dunder
name. You just run the risk that your use of it will conflict with
some official use in the future.
You're the second person mentioning crime or law. What did I say to
give people the impression that I think that using a dunder is a
criminal offence?
I didn't say that it was illegal or breaking the law, or a felony or
even a misdemeaner. I didn't even make a value judgement about
whether it was a good thing or a bad thing to use dunder names.
I said that dunders are reserved. Not everyone knows this.
What should I have said that won't be misinterpreted as an accusation of
criminality?
--
Steven_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/