Re: Scraping of Google Map to get the address of locations for given geocodes.

2021-09-02 Thread 2QdxY4RzWzUUiLuE
On 2021-09-02 at 20:12:19 -0300, Michio Suginoo wrote: > I have the following question regarding how to scrape Google Map to get > address based on a given list of geocodes. > Given a list of geocodes (latitude; longitude) of locations, I would like > to scrape municipalities of all

Scraping of Google Map to get the address of locations for given geocodes.

2021-09-02 Thread Michio Suginoo
Dear all, I have the following question regarding how to scrape Google Map to get address based on a given list of geocodes. Given a list of geocodes (latitude; longitude) of locations, I would like to scrape municipalities of all the spots in the list. How can I do that? For example, I have

Re: What is not working with my "map" usage?

2018-09-22 Thread ROGER GRAYDON CHRISTMAN
ent from each nested list to add up [1,2,3] = 6. How should it be corrected? Thx. > >> alist = [[1,11,111], [2,22,222], [3,33,333]] > >> list(map(add_all_elements,*alist) > > Trylist(map(add_all_elements, alist)) instead. If you give a map a single list as a sec

Re: What is not working with my "map" usage?

2018-09-22 Thread Victor via Python-list
ch nested list to add up [1,2,3] = 6. How should > >>> it be corrected? Thx. > >> > >> I see three options. You can > >> > >> (1) use a list comprehension > >> > >> [add_all_elements(*sub) for sub in alist] > >> >

Re: What is not working with my "map" usage?

2018-09-22 Thread Thomas Jollans
ace map() with itertools.starmap() list(itertools.starmap(add_all_elements, alist)) (3) change your function's signature from add_all_elements(*args) to add_all_elements(args), either by modifying it directly or by wrapping it into another function list(map(lambda args: add_all_elements(*args

Re: What is not working with my "map" usage?

2018-09-22 Thread Peter Otten
> it be corrected? Thx. >> >> I see three options. You can >> >> (1) use a list comprehension >> >> [add_all_elements(*sub) for sub in alist] >> >> (2) replace map() with itertools.starmap() >> >> list(itertools.starmap(add_all_elements, alist)) &

Re: What is not working with my "map" usage?

2018-09-22 Thread Victor via Python-list
with [1,11,111] ==> 1+11+111 = 123. But instead, it appears to take > > the 1st element from each nested list to add up [1,2,3] = 6. How should > > it be corrected? Thx. > > I see three options. You can > > (1) use a list comprehension > > [add_all_ele

Re: What is not working with my "map" usage?

2018-09-22 Thread Peter Otten
rom each nested list to add up [1,2,3] = 6. How should > it be corrected? Thx. I see three options. You can (1) use a list comprehension [add_all_elements(*sub) for sub in alist] (2) replace map() with itertools.starmap() list(itertools.starmap(add_all_elements, alist)) (3) change your fu

Re: What is not working with my "map" usage?

2018-09-22 Thread Victor via Python-list
How should it be corrected? Thx. >>> alist = [[1,11,111], [2,22,222], [3,33,333]] >>> list(map(add_all_elements,*alist)) My args = (1, 2, 3) i = 1 BEFORE total = 0 AFTER total = 1 i = 2 BEFORE total = 1 AFTER total = 3 i = 3 BEFORE total = 3 AFTER total = 6 FINAL total =

Re: What is not working with my "map" usage?

2018-09-21 Thread Thomas Jollans
On 21/09/2018 23:29, Viet Nguyen via Python-list wrote: Hi, I want to add up all of the list elements. But when I use the "map" function, it didn't seem to work as I expect. Could someone point out how "map" can be applied here then? def add_all_elements (*args):

Re: What is not working with my "map" usage?

2018-09-21 Thread Brian Oney via Python-list
Hi Viet, map applies the function to each of the elements of the list you provide. It would be roughly equivalent to: [add_all_elements(x) for x in alist] It may help you to consider the term and function "map" from the view of linear algebra. Apparently it's a com

What is not working with my "map" usage?

2018-09-21 Thread Viet Nguyen via Python-list
Hi, I want to add up all of the list elements. But when I use the "map" function, it didn't seem to work as I expect. Could someone point out how "map" can be applied here then? def add_all_elements (*args): total = 0 for i in args: print(type(i))

in multiprocessing pool map how to stop one process from executing ahead

2018-03-20 Thread Subramanian P V
I am excecting custom commands like shell on multiple linux hosts. and if in one host one of the commands fail. I want that process not to proceed. If the remote command throws an error i am logging it .. but the process goes to next command . but if i terminate the command, the process will t

Re: Plot map wit a white and black box

2018-01-08 Thread breamoreboy
On Monday, January 8, 2018 at 1:16:08 PM UTC, jorge@cptec.inpe.br wrote: > Hi, > > Please, I woudl like to plot a map like this figure. How can I do this > using Python2.7 > > Thanks, > > Conrado Figures don't get through and you've all ready asked t

Plot map wit a white and black box

2018-01-08 Thread jorge . conrado
Hi, Please, I woudl like to plot a map like this figure. How can I do this using Python2.7 Thanks, Conrado -- https://mail.python.org/mailman/listinfo/python-list

Re: plot map wit box axes

2017-12-24 Thread William Ray Wing
> On Dec 23, 2017, at 3:27 PM, breamore...@gmail.com wrote: > > On Friday, December 22, 2017 at 3:42:58 PM UTC, jorge@cptec.inpe.br wrote: >> Hi, >> >> I use the PYTHON and IDL. In IDL I can plot a grid map like a this >> figure (mapa.png). Please, I

Re: plot map wit box axes

2017-12-24 Thread breamoreboy
On Friday, December 22, 2017 at 3:42:58 PM UTC, jorge@cptec.inpe.br wrote: > Hi, > > I use the PYTHON and IDL. In IDL I can plot a grid map like a this > figure (mapa.png). Please, I would like know how can I plot my figure > using PYTHON with the box around the figure. L

plot map wit box axes

2017-12-22 Thread jorge . conrado
Hi, I use the PYTHON and IDL. In IDL I can plot a grid map like a this figure (mapa.png). Please, I would like know how can I plot my figure using PYTHON with the box around the figure. Like this that I plot using the IDL. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Performance of map vs starmap.

2017-11-01 Thread Serhiy Storchaka
30.10.17 12:10, Kirill Balunov пише: Sometime ago I asked this question at SO [1], and among the responses received was paragraph: - `zip` re-uses the returned `tuple` if it has a reference count of 1 when the `__next__` call is made. - `map` build a new `tuple` that is passed to the mapped

Re: Performance of map vs starmap.

2017-10-31 Thread Steve D'Aprano
On Mon, 30 Oct 2017 09:10 pm, Kirill Balunov wrote: > Sometime ago I asked this question at SO [1], and among the responses > received was paragraph: > > - `zip` re-uses the returned `tuple` if it has a reference count of 1 when > the `__next__` call is made. > - `map` build

Performance of map vs starmap.

2017-10-30 Thread Kirill Balunov
Sometime ago I asked this question at SO [1], and among the responses received was paragraph: - `zip` re-uses the returned `tuple` if it has a reference count of 1 when the `__next__` call is made. - `map` build a new `tuple` that is passed to the mapped function every time a `__next__` call is

Re: TypeError with map with no len()

2017-09-26 Thread john polo
= map(math.sin, math.pi*t) If you use np.sin instead of math.sin, you don't have to use map: Most numpy functions operate elementwise on arrays (for example, you're multiplying math.pi with an array - something that wouldn't work with a list). Here's the numpy way of doing th

Re: TypeError with map with no len()

2017-09-25 Thread Thomas Jollans
On 25/09/17 18:44, john polo wrote: > Python List, > > I am trying to make practice data for plotting purposes. I am using > Python 3.6. The instructions I have are > > import matplotlib.pyplot as plt > import math > import numpy as np > t = np.arange(0, 2.5, 0.1) >

Re: TypeError with map with no len()

2017-09-25 Thread john polo
On 9/25/2017 12:03 PM, Paul Moore wrote: You're using Python 3, and I suspect that you're working from instructions that assume Python 2. In Python 3, the result of map() is a generator, not a list (which is what Python 2's map returned). In order to get an actual list (which app

Re: TypeError with map with no len()

2017-09-25 Thread Paul Moore
You're using Python 3, and I suspect that you're working from instructions that assume Python 2. In Python 3, the result of map() is a generator, not a list (which is what Python 2's map returned). In order to get an actual list (which appears to be what you need for your plot call

Re: TypeError with map with no len()

2017-09-25 Thread Grant Edwards
On 2017-09-25, john polo wrote: > Python List, > > I am trying to make practice data for plotting purposes. I am using > Python 3.6. The instructions I have are > > import matplotlib.pyplot as plt > import math > import numpy as np > t = np.arange(0, 2.5, 0.1) >

Re: TypeError with map with no len()

2017-09-25 Thread Peter Otten
john polo wrote: > Python List, > > I am trying to make practice data for plotting purposes. I am using > Python 3.6. The instructions I have are > > import matplotlib.pyplot as plt > import math > import numpy as np > t = np.arange(0, 2.5, 0.1) > y1 = map(math.s

Re: TypeError with map with no len()

2017-09-25 Thread Ned Batchelder
On 9/25/17 12:44 PM, john polo wrote: Python List, I am trying to make practice data for plotting purposes. I am using Python 3.6. The instructions I have are import matplotlib.pyplot as plt import math import numpy as np t = np.arange(0, 2.5, 0.1) y1 = map(math.sin, math.pi*t) plt.plot(t,y1

Re: TypeError with map with no len()

2017-09-25 Thread Terry Reedy
On 9/25/2017 12:44 PM, john polo wrote: Python List, I am trying to make practice data for plotting purposes. I am using Python 3.6. The instructions I have are import matplotlib.pyplot as plt import math import numpy as np t = np.arange(0, 2.5, 0.1) y1 = map(math.sin, math.pi*t) Change to

TypeError with map with no len()

2017-09-25 Thread john polo
Python List, I am trying to make practice data for plotting purposes. I am using Python 3.6. The instructions I have are import matplotlib.pyplot as plt import math import numpy as np t = np.arange(0, 2.5, 0.1) y1 = map(math.sin, math.pi*t) plt.plot(t,y1) However, at this point, I get a

Re: Cross-language comparison: function map and similar

2017-08-24 Thread Steve D'Aprano
On Thu, 17 Aug 2017 12:53 am, Steve D'Aprano wrote: [...] > Are there language implementations which evaluate the result of map() (or its > equivalent) in some order other than the obvious left-to-right first-to-last > sequential order? Is that order guaranteed by the languag

Re: Cross-language comparison: function map and similar

2017-08-20 Thread Stephan Houben
Op 2017-08-16, Steve D'Aprano schreef : > Are there language implementations which evaluate the result of map() > (or its equivalent) in some order other than the obvious left-to-right > first-to-last sequential order? Is that order guaranteed by the > language, or is it an impl

Re: Cross-language comparison: function map and similar

2017-08-17 Thread Steve D'Aprano
On Thu, 17 Aug 2017 03:54 pm, Pavol Lisy wrote: > Is it guaranteed in python? Or future version could implement map with > something like subscriptability "propagation"? > >>>>range(1_000_000_000_000_000_000)[-1] > > >>>> map(

Re: Cross-language comparison: function map and similar

2017-08-17 Thread Chris Angelico
On Thu, Aug 17, 2017 at 3:54 PM, Pavol Lisy wrote: > On 8/16/17, Steve D'Aprano wrote: >> Over in another thread, we've been talking about comprehensions and their >> similarities and differences from the functional map() operation. >> >> Reminder: >&g

Re: Cross-language comparison: function map and similar

2017-08-16 Thread Pavol Lisy
On 8/16/17, Steve D'Aprano wrote: > Over in another thread, we've been talking about comprehensions and their > similarities and differences from the functional map() operation. > > Reminder: > > map(chr, [65, 66, 67, 68]) > > will return ['A', &#

Re: Cross-language comparison: function map and similar

2017-08-16 Thread Paul Rubin
Steve D'Aprano writes: > Are there language implementations which evaluate the result of map() > (or its equivalent) in some order other than the obvious left-to-right > first-to-last sequential order? Is that order guaranteed by the > language, or is it an implementation deta

Re: Cross-language comparison: function map and similar

2017-08-16 Thread Terry Reedy
On 8/16/2017 10:53 AM, Steve D'Aprano wrote: Over in another thread, we've been talking about comprehensions and their similarities and differences from the functional map() operation. Reminder: map(chr, [65, 66, 67, 68]) will return ['A', 'B', 'C']. T

Re: Cross-language comparison: function map and similar

2017-08-16 Thread Rustom Mody
On Wednesday, August 16, 2017 at 8:24:46 PM UTC+5:30, Steve D'Aprano wrote: > Over in another thread, we've been talking about comprehensions and their > similarities and differences from the functional map() operation. > > Reminder: > > map(chr, [65, 66, 67, 68]) &g

Re: Cross-language comparison: function map and similar

2017-08-16 Thread Steve D'Aprano
On Thu, 17 Aug 2017 12:53 am, Steve D'Aprano wrote: > map(chr, [65, 66, 67, 68]) > > will return ['A', 'B', 'C']. Of course I meant ['A', 'B', 'C', 'D']. -- Steve “Cheer up,” they said, “th

Cross-language comparison: function map and similar

2017-08-16 Thread Steve D'Aprano
Over in another thread, we've been talking about comprehensions and their similarities and differences from the functional map() operation. Reminder: map(chr, [65, 66, 67, 68]) will return ['A', 'B', 'C']. My questions for those who know languages apa

Is "two different input map to one unique target called nonlinear case " or "one unique input map to two different target called nonlinear case"? Which learning method can train these two cases or no

2017-01-19 Thread Ho Yeung Lee
Is "two different input map to one unique target called nonlinear case " or "one unique input map to two different target called nonlinear case"? Which learning method can train these two cases or no method to train one of case? -- https://mail.python.org/mailman/listinfo/python-list

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-06 Thread Chris Angelico
On Sun, Nov 6, 2016 at 12:50 AM, Arthur Havlicek wrote: > 2016-11-05 12:47 GMT+01:00 Chris Angelico : > >> On Sat, Nov 5, 2016 at 9:50 PM, Arthur Havlicek >> >> But here's the thing. For everyone who writes a decorator function, >> there could be dozens who use it. >> > > The day that one guy leav

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-06 Thread Arthur Havlicek
2016-11-05 12:47 GMT+01:00 Chris Angelico : > On Sat, Nov 5, 2016 at 9:50 PM, Arthur Havlicek > > But here's the thing. For everyone who writes a decorator function, > there could be dozens who use it. > The day that one guy leaves the team, suddenly you have code that's become a bit tricky to ma

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-05 Thread Chris Angelico
On Sat, Nov 5, 2016 at 9:50 PM, Arthur Havlicek wrote: > Pick 10 programmers for hire and count how many know how to write a > decorator. If you have specified you needed python specialists, you may > have 3-4. If not, you are lucky to find even one. By "write a decorator", I presume you mean imp

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-05 Thread Arthur Havlicek
2016-11-05 9:42 GMT+01:00 Steve D'Aprano : > > I don't know who you are quoting there. It is considered impolite to quote > people without giving attribution, and makes it harder to respond. > My bad. I was unaware of that. This was quoted from Ned Batchelder's mali. 2016-11-05 9:42 GMT+01:00 S

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-05 Thread Steve D'Aprano
ople without giving attribution, and makes it harder to respond. But for what it's worth, I agree with this person. In my code, it is quite common for me to map back to the same *variable*, for example I might write something like this: def process(alist): alist = [float(x) for x in al

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-04 Thread arthurhavlicek
> I don't think that justifies the claim of "especially > bad", which to me implies something much worse. Quicksort has built its popularity by performing better by "a mere factor two" better than mergesort and heapsort. It became the reference sorting algorithm even though its worst case comple

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-04 Thread Chris Angelico
(nearly my namesake) > Okay, I see what you are getting at now: in CPython 3, list comprehensions > are implemented in such a way that the list comprehension requires a > minimum of one function call, while list(map(func, iterable))) requires a > minimum of O(N)+2 function calls: a ca

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-04 Thread Steve D'Aprano
heek I'd like to see you run a Python script containing a list comprehension without opening and closing the .py file. :-P Okay, I see what you are getting at now: in CPython 3, list comprehensions are implemented in such a way that the list comprehension requires a minimum of one function c

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-04 Thread Arthur Havlicek
my proposal. If any in-place operation is "C++ semantics" how do you explain there is already a bunch of in-place operator stuffed in Python that have even less justification to their existance than map or filter does such as sort/sorted, reverse/reversed ? Especially troubling since the o

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Terry Reedy
an iterator. lst[:] = (item for item in list if predicate(item)) lst[:] = map(f, lst) # iterator in 3.x. To save memory, stop using unneeded temporary lists and use iterators instead. If slice assignment is done as I hope it will optimize remain memory operations. (But I have not read the

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Paul Rubin
arthurhavli...@gmail.com writes: > I would gladly appreciate your returns on this, regarding: > 1 - Whether a similar proposition has been made > 2 - If you find this of any interest at all > 3 - If you have a suggestion for improving the proposal Bleccch. Might be ok as a behind-the-scenes optim

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Chris Angelico
On Fri, Nov 4, 2016 at 4:00 AM, Steve D'Aprano wrote: > On Fri, 4 Nov 2016 01:05 am, Chris Angelico wrote: > >> On Thu, Nov 3, 2016 at 7:29 PM, Steven D'Aprano >> wrote: >>>> lst = map (lambda x: x*5, lst) >>>> lst = filter (lambda x: x%3 =

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Arthur Havlicek
it easier over time. Famous example: When you learned programming, you may have had no idea what "+=" was doing, but now you do, you probably rate "a += 2" syntax to be much better than "a = a + 2". You make the economy of a token, but more important, you make your inten

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Steve D'Aprano
On Fri, 4 Nov 2016 01:05 am, Chris Angelico wrote: > On Thu, Nov 3, 2016 at 7:29 PM, Steven D'Aprano > wrote: >>> lst = map (lambda x: x*5, lst) >>> lst = filter (lambda x: x%3 == 1, lst) >>> And perform especially bad in CPython compared to a comprehen

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Terry Reedy
On 11/3/2016 4:29 AM, Steven D'Aprano wrote: Nonsense. It is perfectly readable because it is explicit about what is being done, unlike some magic method that you have to read the docs to understand what it does. Agreed. A list comprehension or for-loop is more general and can be combined so

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Chris Angelico
On Thu, Nov 3, 2016 at 7:29 PM, Steven D'Aprano wrote: >> lst = map (lambda x: x*5, lst) >> lst = filter (lambda x: x%3 == 1, lst) >> And perform especially bad in CPython compared to a comprehension. > > I doubt that. > It's entirely possible. A list comp in

Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread arthurhavlicek
fast way to create lists through comprehensions. Because of their ease of use and efficiency through native implementation, they are an advantageous alternative to map, filter, and more. However, when used in replacement for an in-place version of these functions, they are sub-optimal, and Python

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Ned Batchelder
== 1 > > I think the chances of Guido accepting new syntax for something as trivial as > this with three existing solutions is absolutely zero. > > I think the chances of Guido accepting new list/dict methods for in place map > and/or filter is a tiny bit higher than zero

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Steven D'Aprano
On Thursday 03 November 2016 17:56, arthurhavli...@gmail.com wrote: [...] > Python features a powerful and fast way to create lists through > comprehensions. Because of their ease of use and efficiency through native > implementation, they are an advantageous alternative to map, fi

Re: Create a map for data to flow through

2016-10-03 Thread Gregory Ewing
Sayth Renshaw wrote: Is there a standard library feature that allows you to define a declarative map or statement that defines the data and its objects to be parsed and output format? Not really. Just wondering as for loops are good but when i end up 3-4 for loops deep and want multiple

Create a map for data to flow through

2016-10-02 Thread Sayth Renshaw
Is there a standard library feature that allows you to define a declarative map or statement that defines the data and its objects to be parsed and output format? Just wondering as for loops are good but when i end up 3-4 for loops deep and want multiple matches at each level i am finding it

Re: which library has map reduce and how to use it for this case

2016-06-11 Thread Michael Selik
> > On Friday, June 10, 2016 at 10:04:09 PM UTC+8, Michael Selik wrote: > > You'll need to explain the problem in more detail. Instead of talking > about operators and columns, what is the actual, real-world problem? On Sat, Jun 11, 2016 at 2:21 AM meInvent bbird wrote: > there are six operato

Re: which library has map reduce and how to use it for this case

2016-06-10 Thread meInvent bbird
> input are these six operators, output is finding full column of 27 > > elements add together is 54 > > > > i got memory error when searching this, > > > > i have difficulty in understanding map reduce and transforming my program > > into map reduce probl

Re: which library has map reduce and how to use it for this case

2016-06-10 Thread Michael Selik
On Thu, Jun 9, 2016, 9:11 PM Ho Yeung Lee wrote: > input are these six operators, output is finding full column of 27 > elements add together is 54 > > i got memory error when searching this, > > i have difficulty in understanding map reduce and transforming my program > in

Re: which library has map reduce and how to use it for this case

2016-06-09 Thread Ho Yeung Lee
input are these six operators, output is finding full column of 27 elements add together is 54 i got memory error when searching this, i have difficulty in understanding map reduce and transforming my program into map reduce problem M1 = {} M2 = {} M3 = {} M4 = {} M5 = {} V6 = {} M1['0

Re: which library has map reduce and how to use it for this case

2016-06-09 Thread Michael Selik
I like using Yelp's mrjob module (https://github.com/Yelp/mrjob) to run Python on Hadoop. On Thu, Jun 9, 2016 at 2:56 AM Ho Yeung Lee wrote: > [... a bunch of code ...] If you want to describe a map-reduce problem, start with the data. What does a record of your input data look lik

which library has map reduce and how to use it for this case

2016-06-08 Thread Ho Yeung Lee
i got M1 to M5 and V6 operator and would like to do a full combination and result will also act among each other, map reduce attract my application how to use this in this example? actually below is like vlookup then example is op3(op2(op1(x->y, y->z)), x->z) search which combinat

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Rustom Mody
On Friday, April 1, 2016 at 1:58:29 PM UTC+5:30, Tim Golden wrote: > > For the latter, I take the view that I know where the delete key is (or > the "ignore thread" button or whatever) and I just skip the thread when > it shows up. > Feel free to contact the list owner [python list-owner] if >

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Marko Rauhamaa
Steven D'Aprano : > On Fri, 1 Apr 2016 07:27 pm, Tim Golden wrote: > >> FWIW I'm broadly with Antoon here: wider-ranging discussions can be >> interesting and useful. > > Sure. But sometimes conversations are going nowhere: That's why GNUS has the "k" command to wipe out a whole thread. I know,

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Steven D'Aprano
On Fri, 1 Apr 2016 07:27 pm, Tim Golden wrote: > FWIW I'm broadly with Antoon here: wider-ranging discussions can be > interesting and useful. Sure. But sometimes conversations are going nowhere: http://www.youtube.com/watch?v=kQFKtI6gn9Y http://www.montypython.net/scripts/argument.php [...]

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Mark Lawrence via Python-list
On 01/04/2016 08:59, Antoon Pardon wrote: Op 31-03-16 om 16:12 schreef Mark Lawrence via Python-list: On 31/03/2016 14:27, Random832 wrote: So can we discuss how a unified method to get a set of all valid subscripts (and/or subscript-value pairs) on an object would be a useful thing to have wit

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Tim Golden
On 01/04/2016 08:59, Antoon Pardon wrote: > Op 31-03-16 om 16:12 schreef Mark Lawrence via Python-list: >> On 31/03/2016 14:27, Random832 wrote: >>> So can we discuss how a unified method to get a set of all valid >>> subscripts (and/or subscript-value pairs) on an object would be a useful >>> thin

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Michael Selik
> On Mar 31, 2016, at 10:02 AM, Marko Rauhamaa wrote: > > However, weirdly, dicts have get but lists don't. Read PEP 463 for discussion on this topic. https://www.python.org/dev/peps/pep-0463/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-04-01 Thread Antoon Pardon
Op 31-03-16 om 16:12 schreef Mark Lawrence via Python-list: > On 31/03/2016 14:27, Random832 wrote: >> So can we discuss how a unified method to get a set of all valid >> subscripts (and/or subscript-value pairs) on an object would be a useful >> thing to have without getting bogged down in theoret

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Terry Reedy
On 3/31/2016 10:13 AM, Marko Rauhamaa wrote: One could compose a table of correspondences: with some corrections --- list (L)dict (D) --- L[key] = value

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marko Rauhamaa
Jussi Piitulainen : > operator.itemgetter(*selector)(fields) # ==> ('y', 'y', 'x') > > [...] > > operator.itemgetter(*selector)(field_dict) # ==> ('y', 'y', 'x') > > It's not quite the same but it's close and it works the same for > strings, lists, dicts, ... Not quite the same, but nicely found

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marko Rauhamaa
Random832 : > So can we discuss how a unified method to get a set of all valid > subscripts (and/or subscript-value pairs) on an object would be a > useful thing to have without getting bogged down in theoretical > claptrap about the meaning of the mapping contract? One could compose a table of c

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
On 31/03/2016 14:27, Random832 wrote: On Thu, Mar 31, 2016, at 09:17, Mark Lawrence via Python-list wrote: On 31/03/2016 14:08, Antoon Pardon wrote: Op 31-03-16 om 13:57 schreef Chris Angelico: Okay. I'll put a slightly different position: Prove that your proposal is worth discussing by actual

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marko Rauhamaa
Chris Angelico : > Or, even more likely and even more Pythonic: > >>>> [fields[i] for i in selector] > ['y', 'y', 'x'] > > As soon as you get past the easy and obvious case of an existing > function, filter and map quickly fall behind co

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Rustom Mody
On Thursday, March 31, 2016 at 6:38:56 PM UTC+5:30, Antoon Pardon wrote: > Op 31-03-16 om 13:57 schreef Chris Angelico: > > Okay. I'll put a slightly different position: Prove that your proposal > > is worth discussing by actually giving us an example that we can > > discuss. So far, this thread ha

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Random832
On Thu, Mar 31, 2016, at 09:17, Mark Lawrence via Python-list wrote: > On 31/03/2016 14:08, Antoon Pardon wrote: > > Op 31-03-16 om 13:57 schreef Chris Angelico: > >> Okay. I'll put a slightly different position: Prove that your proposal > >> is worth discussing by actually giving us an example tha

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
On 31/03/2016 14:08, Antoon Pardon wrote: Op 31-03-16 om 13:57 schreef Chris Angelico: Okay. I'll put a slightly different position: Prove that your proposal is worth discussing by actually giving us an example that we can discuss. So far, this thread has had nothing but toy examples (and bogoex

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
On 31/03/2016 13:49, Marco Sulla via Python-list wrote: On 31 March 2016 at 14:30, Mark Lawrence via Python-list wrote: Note that dict also supports __getitem__() and __len__(), but is considered a mapping rather than a sequence because the lookups use arbitrary immutable keys rather than inte

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Chris Angelico
On Fri, Apr 1, 2016 at 12:08 AM, Antoon Pardon wrote: > Op 31-03-16 om 13:57 schreef Chris Angelico: >> Okay. I'll put a slightly different position: Prove that your proposal >> is worth discussing by actually giving us an example that we can >> discuss. So far, this thread has had nothing but toy

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Antoon Pardon
Op 31-03-16 om 13:57 schreef Chris Angelico: > Okay. I'll put a slightly different position: Prove that your proposal > is worth discussing by actually giving us an example that we can > discuss. So far, this thread has had nothing but toy examples (and > bogoexamples that prove nothing beyond that

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Jussi Piitulainen
if you are talking > about treating lists as special cases of dicts, I have occasionally > instinctively wanted something like this: > > >>> fields = [ "x", "y", "z" ] > >>> selector = (1, 1, 0) > >>> list(map(fields.g

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marco Sulla via Python-list
I want also to add that we are focusing on sequences, but my proposal is also to make map interface more similar, introducing a vdict type that iterates over values, and this will be for me really more practical. PEP 234 ( http://legacy.python.org/dev/peps/pep-0234/ ) never convinced me. Van

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Chris Angelico
s an example that we can >> discuss. > > Sorry for missing most of the arguments here, but if you are talking > about treating lists as special cases of dicts, I have occasionally > instinctively wanted something like this: > > >>> fields = [ "x", &qu

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marko Rauhamaa
t if you are talking about treating lists as special cases of dicts, I have occasionally instinctively wanted something like this: >>> fields = [ "x", "y", "z" ] >>> selector = (1, 1, 0) >>> list(map(fields.get, selector)) T

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Mark Lawrence via Python-list
ram, where it is desirable that adding or deleting one key will modify the rest of the keys in the mapping. 1. the example was for confuting your assertion that an implementation of sequences as extended classes of maps violate the map contract. 2. I already linked a real-world example previously.

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Marco Sulla via Python-list
deleting one key will modify the rest of the keys in the mapping. 1. the example was for confuting your assertion that an implementation of sequences as extended classes of maps violate the map contract. 2. I already linked a real-world example previously. Google it and you can find tons of examp

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Chris Angelico
On Thu, Mar 31, 2016 at 10:22 PM, Antoon Pardon wrote: > Op 31-03-16 om 12:36 schreef Steven D'Aprano: >> On Thu, 31 Mar 2016 06:52 pm, Antoon Pardon wrote: >> >>> it is your burden to argue that problem. >> No it isn't. I don't have to do a thing. All I need to do is sit back and >> wait as this

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Antoon Pardon
Op 31-03-16 om 12:36 schreef Steven D'Aprano: > On Thu, 31 Mar 2016 06:52 pm, Antoon Pardon wrote: > >> it is your burden to argue that problem. > No it isn't. I don't have to do a thing. All I need to do is sit back and > wait as this discussion peters off into nothing. The burden isn't on me to >

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Antoon Pardon
Op 31-03-16 om 12:36 schreef Steven D'Aprano: > On Thu, 31 Mar 2016 06:52 pm, Antoon Pardon wrote: > >> it is your burden to argue that problem. > No it isn't. I don't have to do a thing. If that is how you think about this, why do you contribute? I completly understand if you are of the opinion t

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Steven D'Aprano
On Thu, 31 Mar 2016 06:52 pm, Antoon Pardon wrote: > it is your burden to argue that problem. No it isn't. I don't have to do a thing. All I need to do is sit back and wait as this discussion peters off into nothing. The burden isn't on me to justify the status quo. The burden is on those who wan

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Antoon Pardon
Op 31-03-16 om 04:44 schreef Steven D'Aprano: > On Thu, 31 Mar 2016 03:52 am, Random832 wrote: > >> Like, these are common patterns: >> >> for i, x in enumerate(l): >># do some stuff, sometimes assign l[i] >> >> for k, v in d.items(): >># do some stuff, sometimes assign d[k] > > for a, b in

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Antoon Pardon
Op 31-03-16 om 04:40 schreef Steven D'Aprano: > On Thu, 31 Mar 2016 06:07 am, Antoon Pardon wrote: > >>> Because fundamentally, it doesn't matter whether dicts are surjections or >>> not. They're still many-to-one mappings, and those mappings between keys >>> and values should not change due to the

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Steven D'Aprano
On Thursday 31 March 2016 13:45, Paul Rubin wrote: > Steven D'Aprano writes: >> I want to see an actual application where adding a new key to a .^ >> mapping is expected to change the other keys. > directory["mary.roommate"] = "bob" > directory["mary.address"

Re: Suggestion: make sequence and map interfaces more similar

2016-03-30 Thread Paul Rubin
Steven D'Aprano writes: > I want to see an actual application where adding a new key to a > mapping is expected to change the other keys. directory["mary.roommate"] = "bob" directory["mary.address"] = None # unknown address ... directory["bob.address"] = "132 Elm Street" Since Bob and Mary are

  1   2   3   4   5   6   7   8   9   >