Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
> > I think it should follow the pre-existing behaviour of list, set, tuple, > etc. > > >>> Vector("hello") > > I try to keep the underlying datatype of the wrapped collection as much as possible. Casting a string to a list changes that. >>> Vector(d) >>> Vector(tuple(d)) >>> Vector(set(d))

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
On Sat, Feb 2, 2019 at 10:00 PM MRAB wrote: > Perhaps a reserved attribute that let's you refer to the vector itself > instead of its members, e.g. '.self'? > > >>> len(v) > > >>> len(v.self) > 12 > I like that! But I'm not sure if '.self' is misleading. I use an attribute called '._it'

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread MRAB
On 2019-02-03 02:03, David Mertz wrote: Slightly more on my initial behavior: >>> Vector({1:2,3:4}) TypeError: Ambiguity vectorizing a map, perhaps try it.keys(), it.values(), or it.items() >>> Vector(37) TypeError: Vector can only be initialized with an iterable

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
Trying to make iterators behave in a semi-nice way also. I kinda like this (example remains silly, but it shows idea). >>> for n, mon in enumerate(vi.upper().replace('J','_').title()): ... print(mon) ... if n>3: break ... ... _An Feb Mar Apr May >>> vi > >>> list(vi) ['Jun', 'Jul', 'Aug',

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread MRAB
On 2019-02-03 01:54, David Mertz wrote: Here is a very toy proof-of-concept: >>> from vector import Vector >>> l = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split() >>> v = Vector(l) >>> v >>> v.strip().lower().replace('a','X') >>> vt =

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
Slightly more on my initial behavior: >>> Vector({1:2,3:4}) TypeError: Ambiguity vectorizing a map, perhaps try it.keys(), it.values(), or it.items() >>> Vector(37) TypeError: Vector can only be initialized with an iterable >>> Vector("hello") I'm wondering if maybe making a vector out of a

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread Oleg Broytman
On Sun, Feb 03, 2019 at 02:52:31AM +0100, Oleg Broytman wrote: > On Sat, Feb 02, 2019 at 07:37:56PM -0500, Terry Reedy > wrote: > > On 2/2/2019 8:13 AM, Oleg Broytman wrote: > > > > IDLE does this. > > > > > > For the question "Does Python REPL need more batteries?" is your > > > answer

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
Here is a very toy proof-of-concept: >>> from vector import Vector >>> l = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split() >>> v = Vector(l) >>> v >>> v.strip().lower().replace('a','X') >>> vt = Vector(tuple(l)) >>> vt >>> vt.lower().replace('o','X') My few lines are at

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread Oleg Broytman
On Sat, Feb 02, 2019 at 07:37:56PM -0500, Terry Reedy wrote: > On 2/2/2019 8:13 AM, Oleg Broytman wrote: > > > IDLE does this. > > > > For the question "Does Python REPL need more batteries?" is your > > answer "No, just point people to IDLE"? > > If one want these batteries *today*, that

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Greg Ewing
MRAB wrote: Well, if we were using an English prefix, wouldn't it be "unhomogeneous"? If we're sticking with Greek it would have to be something like "anhomogeneous". -- Greg ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Ben Rudiak-Gould
Note: none of the following is an endorsement of the r/python_ideas idea. I'm just responding point-by-point to what you wrote. On Fri, Feb 1, 2019 at 10:47 PM Steven D'Aprano wrote: > - I can have as many email identities as I like; I can only have one > Reddit identity at a time. Do you mean

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread Terry Reedy
On 2/2/2019 8:13 AM, Oleg Broytman wrote: On Fri, Feb 01, 2019 at 08:40:22PM -0500, Terry Reedy wrote: On 2/1/2019 3:31 PM, Oleg Broytman wrote: Python REPL is missing the following batteries: That is why, on Windows, I nearly always use IDLE. I believe this was Chris, not me. *

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 11:12:02AM -0500, James Lu wrote: > This list IS hard for newcomers. I wish there was one place where I > could read up on how to not feel like a noob. It has become unfashionable to link to this, because it is allegedly too elitest and unfriendly and not welcoming

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 10:59:36AM -0500, James Lu wrote: > I think we need to step away from the egalitarian ideal and have some > way of knowing that Python committees are python committers. It’s > really difficult to know how well your proposal is doing without > having this. Speaking of

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Ben Rudiak-Gould
On Sat, Feb 2, 2019 at 3:31 PM Steven D'Aprano wrote: > The comprehension version isn't awful: > > [(a*2).name.upper() for a in seq] > > but not all vectorized operations can be written as a chain of calls on > a single sequence. > If they are strictly parallel (no dot products) and you

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
My double dot was a typo on my tablet, not borrowing Julia syntax, in this case. On Sat, Feb 2, 2019, 6:43 PM David Mertz On Sat, Feb 2, 2019, 6:23 PM Christopher Barker > >> a_list_of_strings.strip().lower().title() >> >> is a lot nicer than: >> >> [s.title() for s in (s.lower() for s in

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Chris Angelico
On Sun, Feb 3, 2019 at 10:36 AM Ben Rudiak-Gould wrote: > > On Sat, Feb 2, 2019 at 3:23 PM Christopher Barker wrote: >> >> a_list_of_strings.strip().lower().title() >> >> is a lot nicer than: >> >> [s.title() for s in (s.lower() for s in [s.strip(s) for s in >> a_list_of_strings])] >> >> or >>

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
On Sat, Feb 2, 2019, 6:23 PM Christopher Barker > a_list_of_strings.strip().lower().title() > > is a lot nicer than: > > [s.title() for s in (s.lower() for s in [s.strip(s) for s in > a_list_of_strings])] > > or > > list(map(str.title, (map(str.lower, (map(str.strip, a_list_of_strings > #

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 03:22:12PM -0800, Christopher Barker wrote: [This bit was me] > Even numpy supports inhomogeneous data: > > py> a = np.array([1, 'spam']) > > py> a > > array(['1', 'spam'], > > dtype='|S4') > > > well, no -- it doesn't -- look carefully, that is an array or type

Re: [Python-ideas] Clearer communication

2019-02-02 Thread James Lu
I think we need to step away from the egalitarian ideal and have some way of knowing that Python committees are python committers. It’s really difficult to know how well your proposal is doing without having this. ___ Python-ideas mailing list

Re: [Python-ideas] Clearer communication

2019-02-02 Thread James Lu
This list IS hard for newcomers. I wish there was one place where I could read up on how to not feel like a noob. ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct:

[Python-ideas] What factors led Guido to quit?

2019-02-02 Thread James Lu
I want y’all to think about this very carefully. What factors led Guido to quit? And I don’t want you to just reply with the first thing that comes off your head. The purpose of this question/discussion is to identify problems with the Python community so we can fix them. That is the only real

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Chris Angelico
On Sun, Feb 3, 2019 at 10:31 AM Steven D'Aprano wrote: > The dot arguably fails the "syntax should not look like grit on Tim's > monitor" test (although attribute access already fails that test). I > think the double-dot syntax looks like a typo, which is unfortunate. Agreed, so I would like to

Re: [Python-ideas] Clearer communication

2019-02-02 Thread James Lu
It’s very demotivating to hear just negative feedback on this list. Was starting this thread useful for y’all? ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct:

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Ben Rudiak-Gould
On Sat, Feb 2, 2019 at 3:23 PM Christopher Barker wrote: > performance asside, I use numpy because: > > c = np.sqrt(a**2 + b**2) > > is a heck of a lot easer to read, write, and get correct than: > > c = list(map(math.sqrt, map(lambda x, y: x + y, map(lambda x: x**2, a), >

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 06:08:24PM -0500, David Mertz wrote: > In terms of other examples: > > map(str.upper, seq) uppercases each item > map(operator.attrgetter('name'), seq) gets the name attribute of each item > map(lambda a: a*2, seq) doubles each item Now compose those operations:

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Christopher Barker
On Fri, Feb 1, 2019 at 5:00 PM David Mertz wrote: > is is certainly doable. But why would it be better than: >> > > map(str.lower, my_string_vector) > map(compute_grad, my_student_vector) > or [s.lower() for s in my_string_vector] Side note: It's really interesting to me that Python introduced

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 03:31:29PM -0500, David Mertz wrote: > I still haven't seen any examples that aren't already spelled 'map(fun, it)' You might be right. But then there's nothing that map() can do that couldn't be written as a comprehension, and nothing that you can't do with a

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
Beyond possibly saving 3-5 characters, I continue not to see anything different from map in this discussion. list(vector) applies list to the vector itself. > list.(vector) applies list to each component of vector. > In Python: list(seq) applies list to the sequence itself map(list, seq)

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 07:58:34PM +, Jeff Allen wrote: [MRAB asked] > >OK, here's another one: if you use 'list(...)' on a vector, does it > >apply to the vector itself or its members? With the Julia vectorization operator, there is no puzzle there. list(vector) applies list to the vector

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Brendan Barnwell
On 2019-02-02 12:31, David Mertz wrote: I still haven't seen any examples that aren't already spelled 'map(fun, it)' The problem with this is the same problem with having a function called "add" instead of an operator. There is little gain when you're applying ONE function, but if you're

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread David Mertz
I still haven't seen any examples that aren't already spelled 'map(fun, it)' On Sat, Feb 2, 2019, 3:17 PM Jeff Allen On 02/02/2019 18:44, MRAB wrote: > > On 2019-02-02 17:31, Adrien Ricocotam wrote: > > I personally would the first option to be the case. But then vectors > shouldn't be list-like

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Jeff Allen
On 02/02/2019 18:44, MRAB wrote: On 2019-02-02 17:31, Adrien Ricocotam wrote: > I personally would the first option to be the case. But then vectors shouldn't be list-like but more generator like. > OK, here's another one: if you use 'list(...)' on a vector, does it apply to the vector itself

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Adrien Ricocotam
That's tough. I'd say conver the vector to a list. But : my_vector.list() Would apply list on each element of the vector. Globally, I'd say if the vector is used as an argument, it's a usual iterable, if you use a member function (or any other notation like @ or .. or whatever) it's like map.

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread MRAB
On 2019-02-02 17:31, Adrien Ricocotam wrote: > I personally would the first option to be the case. But then vectors shouldn't be list-like but more generator like. > OK, here's another one: if you use 'list(...)' on a vector, does it apply to the vector itself or its members? >>>

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Adrien Ricocotam
I personally would the first option to be the case. But then vectors shouldn't be list-like but more generator like. Le sam. 2 févr. 2019 à 19:26, MRAB a écrit : > On 2019-02-02 09:22, Kirill Balunov wrote: > > > > > > сб, 2 февр. 2019 г. в 07:33, Steven D'Aprano >

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread MRAB
On 2019-02-02 09:22, Kirill Balunov wrote: сб, 2 февр. 2019 г. в 07:33, Steven D'Aprano >: I didn't say anything about a vector type. I agree  you did not say. But since you started a new thread from the one where the vector type was a little discussed, it

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread MRAB
On 2019-02-02 08:58, Steven D'Aprano wrote: On Sat, Feb 02, 2019 at 05:10:14AM +, MRAB wrote: On 2019-02-02 04:32, Steven D'Aprano wrote: [snip] > >Of course it makes sense. Even numpy supports inhomogeneous data: > [snip] "inhomogeneous"? Who came up with that? I don't know, but it has

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Adrien Ricocotam
The community is really opened on the subject and I didn't receive any bad feelings about my English writing. I just wanted to remember everyone that a lot of us are non-native and despite the fact we speak well, we might not actually transmit exactly what we thought, nor understand what was

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Hasan Diwan
On Sat, 2 Feb 2019 at 06:12, Paul Moore wrote: > On Sat, 2 Feb 2019 at 13:55, Adrien Ricocotam wrote: > > Just a point about writing clear and precise English. For a good part of > the audience and the writers, English is not our native language. Even if > I’m considered good in English

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Paul Moore
On Sat, 2 Feb 2019 at 13:55, Adrien Ricocotam wrote: > Just a point about writing clear and precise English. For a good part of the > audience and the writers, English is not our native language. Even if I’m > considered good in English according to the standards in France, will far > from

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread David Mertz
On Sat, Feb 2, 2019, 8:15 AM Oleg BroytmanFor the question "Does Python REPL need more batteries?" is your > answer "No, just point people to IDLE"? >If it is - well, I disagree. I implemented a lot of enhancements for > REPL myself, and I don't like and avoid GUI programs > IPython and

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Adrien Ricocotam
Thanks Steve, that’s a good point, I might have been in one of the bad things you describe. It’s kinda funny that Python is conservative while being heavily used in the most recent techonologies (referring to machine learning). I personally think it’s not good but I might be too young for being

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread Oleg Broytman
On Sat, Feb 02, 2019 at 03:37:36PM +1100, Steven D'Aprano wrote: > Sorry, I was not as clear as I ought to have been: > > On Sat, Feb 02, 2019 at 02:10:06PM +1100, Steven D'Aprano wrote: > > > > * Clear separation (using, for example, different colors) > > > between input, output and errors;

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread Oleg Broytman
On Sat, Feb 02, 2019 at 02:10:06PM +1100, Steven D'Aprano wrote: > On Fri, Feb 01, 2019 at 09:31:21PM +0100, Oleg Broytman wrote: > > >Python REPL is missing the following batteries: > > > > * Persistent history; > > On Linux/Unix systems, that has been available for about 18+ years, >

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread Oleg Broytman
On Fri, Feb 01, 2019 at 08:43:53PM -0600, eryk sun wrote: > On 2/1/19, Terry Reedy wrote: > > On 2/1/2019 3:31 PM, Oleg Broytman wrote: > > > >> Python REPL is missing the following batteries: > >> * Persistent history; > > Python's built-in REPL relies on the readline module for history. In >

Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-02 Thread Oleg Broytman
On Fri, Feb 01, 2019 at 08:40:22PM -0500, Terry Reedy wrote: > On 2/1/2019 3:31 PM, Oleg Broytman wrote: > > > Python REPL is missing the following batteries: > > That is why, on Windows, I nearly always use IDLE. > > > * Persistent history; > > IDLE's Shell history persists across restarts

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Steven D'Aprano
On Fri, Feb 01, 2019 at 11:40:37AM -0500, James Lu wrote: > So I want an open discussion on: How can we communicate clearer? Remember the Curse of Knowledge: just because you know something, don't imagine that all your readers know it too. https://en.wikipedia.org/wiki/Curse_of_knowledge

Re: [Python-ideas] Consistency in naming [was Re: ...ALL CAPS]

2019-02-02 Thread Anders Hovmöller
> Python has been around not quite 30 years now, so we can expect that it > will probably last another 30 years. But chances are not good that it > will be around in 300 years. With that attitude the odds go up *wink* / Anders ___ Python-ideas

Re: [Python-ideas] Clearer communication

2019-02-02 Thread Steven D'Aprano
On Fri, Feb 01, 2019 at 05:36:09PM -0600, Abe Dillon wrote: > B) I don't know of any forum system that allows you to misrepresent some > one else. Core developer Brett Cannon has taken up editing other people's comments on github if he doesn't approve of their tone. I'm now proactively

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Adrien Ricocotam
@D’aprano I think you’re misleading by what I said, sorry for not being crystal clear. I just read the link on Julia (which I didn’t do) and I get what you mean now and it’s not quite different from what I said. I proposed introducing a new type : « vector » A few steps have been made in Python

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Kirill Balunov
сб, 2 февр. 2019 г. в 07:33, Steven D'Aprano : > > I didn't say anything about a vector type. > > I agree you did not say. But since you started a new thread from the one where the vector type was a little discussed, it seemed to me that it is appropriate to mention it here. Sorry about that.

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 02:06:56AM -0500, Alex Walters wrote: > "Television" as a word must annoy you :) I mentally replaced > "inhomogeneous" with "heterogeneous" They don't mean the same thing. https://english.stackexchange.com/questions/194906/heterogeneous-vs-inhomogeneous -- Steven

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 05:10:14AM +, MRAB wrote: > On 2019-02-02 04:32, Steven D'Aprano wrote: > [snip] > > > >Of course it makes sense. Even numpy supports inhomogeneous data: > > > [snip] > > "inhomogeneous"? Who came up with that? I don't know, but it has been used since at least the

Re: [Python-ideas] Consistency in naming [was Re: ...ALL CAPS]

2019-02-02 Thread Steven D'Aprano
On Sat, Feb 02, 2019 at 12:06:47AM +0100, Anders Hovmöller wrote: > > > - the status quo means "no change", so there is no hassle there; > > Not quite true. There is a constant hassle of "do I need to write > datetime.datetime.now() or datetime.now()?" My point was that there is no hassle from