[Python-ideas] Simple math vs. language design [was: ... prettiness aware[ness]]

2020-03-16 Thread Stephen J. Turnbull
David Mertz writes: > On Mon, Mar 16, 2020, 5:57 AM Stephen J. Turnbull < > turnbull.stephen...@u.tsukuba.ac.jp> wrote: > > > s/people/mathematicians/ and I'd agree with you. But I did write "people". > > > > Are mathematicians not people? :-) As a mathematician who is a people (I am

[Python-ideas] Simple math vs. language design [was: ... prettiness aware[ness]]

2020-03-16 Thread Stephen J. Turnbull
Taking Rob Cliffe's statement in good part, changing the subject (belatedly, sorry!) Andrew Barnert writes: > What does FVO mean? Sorry. "For values of" > At any rate, there’s nothing wrong with simplistic. My usage of simplistic is to simple as complicated is to complex. The distinction

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread C. Titus Brown
(no reason to moderate a topic that wanders off what you think is the linear path, Rob… no one is violating CoC and that’s mostly what I care about) > On Mar 16, 2020, at 6:11 PM, Rob Cliffe via Python-ideas > wrote: > > This makes on my count 6 messages on arcane mathematical topics that

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Christopher Barker
On Mon, Mar 16, 2020 at 2:22 PM Andrew Barnert wrote: > > Yes, everyone who designs a sorted container library runs into the fact > that a SortedList is a Sequence, and mutable, but not even close to a > MutableSequence—it’s not just append and extend; you can’t even do > __setitem__. In fact,

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Rob Cliffe via Python-ideas
This makes on my count 6 messages on arcane mathematical topics that have nothing to do with the original proposition, which was to do with prettyprinting. Don't get me wrong - I enjoy such discussions as much as anyone, considering myself a mathematician of sorts.  But it must be frustrating

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread David Mertz
On Mon, Mar 16, 2020, 5:57 AM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > s/people/mathematicians/ and I'd agree with you. But I did write "people". > Are mathematicians not people? :-) If they are, them "some mathematicians" implies "some people."

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Barry Scott
> On 16 Mar 2020, at 20:59, James Edwards wrote: > > I would love a formalized, for example, __pretty__ hook. Many of our classes > have __pretty__ and __json__ "custom" dunders defined and our PrettyPrinters > / JSONEncoders have checks for them (though the __pretty__ API has proven >

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Andrew Barnert via Python-ideas
On Mar 16, 2020, at 11:52, Christopher Barker wrote: > >> On Mon, Mar 16, 2020 at 11:36 AM Andrew Barnert wrote: > > > Anyway, my only point was that we DO want to consider both performance and > semantics here -- a Sorted Dict (or SortedList, or ...) has different use > cases, and thus

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread James Edwards
I would love a formalized, for example, __pretty__ hook. Many of our classes have __pretty__ and __json__ "custom" dunders defined and our PrettyPrinters / JSONEncoders have checks for them (though the __pretty__ API has proven difficult to stabilize). w/r/t to repurposing __str__, I

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Christopher Barker
On Mon, Mar 16, 2020 at 11:36 AM Andrew Barnert wrote: > > Note that the OP used the word "semantics", but primarily meant > "performance characteristics": > > IIRC, the C++ specification includes guaranteed performance > characteristics as part of its library semantics, Now we are getting

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Andrew Barnert via Python-ideas
On Mar 16, 2020, at 09:53, Christopher Barker wrote: > >  > Note that the OP used the word "semantics", but primarily meant "performance > characteristics": IIRC, the C++ specification includes guaranteed performance characteristics as part of its library semantics, so an implementation

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Barry
> On 16 Mar 2020, at 14:43, Ben Rudiak-Gould wrote: > > On Mon, Mar 16, 2020 at 12:57 AM Andrew Barnert wrote: >> Even if the extra indirection overhead turns out not to be an issue, just >> from the added complexity (to every possible implementation) it seems like >> it would be a bad

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Andrew Barnert via Python-ideas
On Mar 16, 2020, at 10:39, Barry wrote: > > >>> On 16 Mar 2020, at 14:43, Ben Rudiak-Gould wrote: >>> >>> On Mon, Mar 16, 2020 at 12:57 AM Andrew Barnert wrote: >>> Even if the extra indirection overhead turns out not to be an issue, just >>> from the added complexity (to every possible

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Andrew Barnert via Python-ideas
On Mar 16, 2020, at 02:54, Stephen J. Turnbull wrote: > > Andrew Barnert writes: > >> Well, there are an infinite number of ever larger infinite >> ordinals, ω or ω_0 being the first one, and likewise an infinite >> number of infinite cardinal, aleph_0 being the first one, and >> people

[Python-ideas] Re: Formalized pretty & encoding-aware object representation (was dunder methods for...)

2020-03-16 Thread Steve Jorgensen
Oops. Somehow this subject was posted twice. Please ignore this thread & follow the other thread with the same subject line. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Formalized pretty & encoding-aware object representation (was dunder methods for...)

2020-03-16 Thread Steve Jorgensen
Steve Jorgensen wrote: > Based on the conversations stemming from my previous post, it is clear that > the topic > was too implementation-specific. It is not clear whether dunder methods are > an appropriate > component of the solution (they might or might not be). > Also, it presumably makes

[Python-ideas] Formalized pretty & encoding-aware object representation (was dunder methods for...)

2020-03-16 Thread Steve Jorgensen
Based on the conversations stemming from my previous post, it is clear that the topic was too implementation-specific. It is not clear whether dunder methods are an appropriate component of the solution (they might or might not be). This suggestion is to try to solve 2 inter-related but

[Python-ideas] Re: More appropriate behavior for the NotImplemented object

2020-03-16 Thread Christopher Barker
This has turned into a rant about numpy and the scipy ecosystem -- not relevant at all to python-ideas. Please stop. -CHB On Mon, Mar 16, 2020 at 9:51 AM Marco Sulla wrote: > On Mon, 16 Mar 2020 at 04:51, Kyle Stanley wrote: > > PEP 8 itself is very far from a definitive authority. Its

[Python-ideas] Formalized pretty & encoding-aware object representation (was dunder methods for...)

2020-03-16 Thread Steve Jorgensen
Based on the conversations stemming from my previous post, it is clear that the topic was too implementation-specific. It is not clear whether dunder methods are an appropriate component of the solution (they might or might not be). Also, it presumably makes sense to start by looking at prior

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Christopher Barker
Note that the OP used the word "semantics", but primarily meant "performance characteristics": * We can insert elements into the structure in time faster than O(n), i.e. > O(logn) for std::map > * We can iterate over all of the elements of the structure in sorted order > in linear time, i.e. O(n)

[Python-ideas] Re: More appropriate behavior for the NotImplemented object

2020-03-16 Thread Marco Sulla
On Mon, 16 Mar 2020 at 04:51, Kyle Stanley wrote: > PEP 8 itself is very far from a definitive authority. Its scope is > specifically intended to cover CPython stdlib development, not all uses of > Python. Yes, I know. But it's a common convention, and Python relies often on conventions. For

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Christopher Barker
> > On Mon, Mar 16, 2020, 1:04 AM Greg Ewing > wrote: > >> >> Also, strs and reprs of arbitrary objects often end up in places >> such as log files which aren't equipped to handle unicode or other >> fancy things. So keeping them as basic as possible is a good idea. >> > > Is this why __unicode__

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Ben Rudiak-Gould
On Mon, Mar 16, 2020 at 12:57 AM Andrew Barnert wrote: > Even if the extra indirection overhead turns out not to be an issue, just > from the added complexity (to every possible implementation) it seems like it > would be a bad idea to make that a requirement. The only change needed to support

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Wes Turner
On Mon, Mar 16, 2020, 3:41 AM Andrew Barnert via Python-ideas < python-ideas@python.org> wrote: > On Mar 15, 2020, at 22:37, Stephen J. Turnbull < > turnbull.stephen...@u.tsukuba.ac.jp> wrote: > > > > > > Because they're not always available, even in 2020. Also, ∞ is > > ambiguous; it's used for

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Steven D'Aprano
On Mon, Mar 16, 2020 at 01:25:13AM -0400, Wes Turner wrote: [Greg] > > Also, strs and reprs of arbitrary objects often end up in places > > such as log files which aren't equipped to handle unicode or other > > fancy things. So keeping them as basic as possible is a good idea. > > > > Is this

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Steven D'Aprano
On Sun, Mar 15, 2020 at 11:37:53PM -0400, Wes Turner wrote: > Monkeypatching the __str__ or __repr__ of a builtin is generally > undesirable because that's global and not thread safe. Monkeypatching the __str__ or __repr__ of a builtin is generally impossible. py> int.__repr__ = lambda self:

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Stephen J. Turnbull
Andrew Barnert writes: > Well, there are an infinite number of ever larger infinite > ordinals, ω or ω_0 being the first one, and likewise an infinite > number of infinite cardinal, aleph_0 being the first one, and > people rarely use the ∞ symbol for any of them. s/people/mathematicians/

[Python-ideas] Re: SQL string prefix idea

2020-03-16 Thread Steven D'Aprano
On Mon, Mar 16, 2020 at 02:36:25PM +0900, Stephen J. Turnbull wrote: > Kyle Stanley writes: > > > The behavior is the same on Python 3.8.2: > > > > Python 3.8.2 (default, Feb 26 2020, 22:21:03) > > [GCC 9.2.1 20200130] on linux > > Type "help", "copyright", "credits" or "license" for more

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Andrew Barnert via Python-ideas
> On Mar 16, 2020, at 00:13, Ben Rudiak-Gould wrote: > > On Sun, Mar 15, 2020 at 9:41 PM Andrew Barnert via Python-ideas > wrote: >> Do you really want to require “binary”? > > I don't think so; they never talked about binary trees, only "binary > search tree semantics." It could alternately

[Python-ideas] Re: dunder methods for encoding & prettiness aware formal & informal representations

2020-03-16 Thread Andrew Barnert via Python-ideas
On Mar 15, 2020, at 22:37, Stephen J. Turnbull wrote: > > > Because they're not always available, even in 2020. Also, ∞ is > ambiguous; it's used for the ordinal number infinity (IIRC, more > precisely denoted ω), the cardinal number infinity, the positive limit > of the real line, the

[Python-ideas] Re: Adding a built-in data structure with binary search tree semantics

2020-03-16 Thread Ben Rudiak-Gould
On Sun, Mar 15, 2020 at 9:41 PM Andrew Barnert via Python-ideas wrote: > Do you really want to require “binary”? I don't think so; they never talked about binary trees, only "binary search tree semantics." It could alternately be called autobalanced tree semantics or something. >Sorted