Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Inada Naoki
On Tue, Apr 23, 2019 at 2:18 AM Chris Barker via Python-Dev wrote: > > On Fri, Apr 12, 2019 at 10:20 AM Brett Cannon wrote: >>> >>> >> This doesn't strike me as needing an optimization through a dedicated method. > > maybe a new dict mapping type -- "shared_dict" -- it would be used in places >

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Glenn Linderman
On 4/22/2019 4:03 PM, Inada Naoki wrote: On Tue, Apr 23, 2019 at 2:18 AM Chris Barker via Python-Dev wrote: On Fri, Apr 12, 2019 at 10:20 AM Brett Cannon wrote: This doesn't strike me as needing an optimization through a dedicated method. maybe a new dict mapping type -- "shared_dict" --

Re: [Python-Dev] Concurrent.futures: no type discovery for PyCharm

2019-04-22 Thread Andrew Svetlov
I see the chicken and egg problem here. If we are talking about typing module usage -- typeshed is the type hints provider. If PyCharm doesn't want to use it -- it is not CPython problem. I think there is no need to change python code itself but used tooling. On Mon, Apr 22, 2019 at 11:06 PM

Re: [Python-Dev] Concurrent.futures: no type discovery for PyCharm

2019-04-22 Thread Inada Naoki
On Tue, Apr 23, 2019 at 4:40 AM Brett Cannon wrote: > > On Sat, Apr 20, 2019 at 2:10 PM Inada Naoki wrote: >> >> "import typing" is slow too. > > But is it so slow as to not do the right thing here and use the 'typing' > module as expected? I don't know it is not a "right thing" yet. It feel

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Glenn Linderman
On 4/22/2019 5:19 PM, Steven D'Aprano wrote: Oh, you mean just like regular dicts with shared keys already do:-) https://www.python.org/dev/peps/pep-0412/ Perhaps I've missed something in this discussion, but isn't this a matter of just making the existing shared-keys functionality explicitly

Re: [Python-Dev] Concurrent.futures: no type discovery for PyCharm

2019-04-22 Thread Steve Dower
On 22Apr2019 1521, Andrew Svetlov wrote: I see the chicken and egg problem here. If we are talking about typing module usage -- typeshed is the type hints provider. If PyCharm doesn't want to use it -- it is not CPython problem. I think there is no need to change python code itself but used

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Steven D'Aprano
On Mon, Apr 22, 2019 at 10:06:20AM -0700, Chris Barker via Python-Dev wrote: > maybe a new dict mapping type -- "shared_dict" -- it would be used in > places like the csv reader where it makes sense, but wouldn't impact the > regular dict at all. > > you could get really clever an have it

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Steve Dower
On 22Apr2019 1822, Glenn Linderman wrote: Inada is now proposing a way to allow the coder to suggest a group of dictionaries that might benefit from the same gains, by preclassifying non-__dict__ slot dictionaries to do similar sharing. CSV reader is an exemplary candidate, because it creates

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Steve Dower
On 22Apr2019 1921, Steve Dower wrote: On 22Apr2019 1822, Glenn Linderman wrote: Inada is now proposing a way to allow the coder to suggest a group of dictionaries that might benefit from the same gains, by preclassifying non-__dict__ slot dictionaries to do similar sharing. CSV reader is an

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Inada Naoki
On Tue, Apr 23, 2019 at 11:30 AM Steve Dower wrote: > > Or possibly just "dict(existing_dict).update(new_items)". > Do you mean .update accepts values tuple? I can't think it's > My primary concern is still to avoid making CPython performance > characteristics part of the Python language

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Glenn Linderman
On 4/22/2019 7:27 PM, Steve Dower wrote: On 22Apr2019 1921, Steve Dower wrote: On 22Apr2019 1822, Glenn Linderman wrote: Inada is now proposing a way to allow the coder to suggest a group of dictionaries that might benefit from the same gains, by preclassifying non-__dict__ slot dictionaries

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Glenn Linderman
On 4/22/2019 7:27 PM, Steve Dower wrote: On 22Apr2019 1921, Steve Dower wrote: On 22Apr2019 1822, Glenn Linderman wrote: Inada is now proposing a way to allow the coder to suggest a group of dictionaries that might benefit from the same gains, by preclassifying non-__dict__ slot dictionaries

Re: [Python-Dev] Proposal: dict.with_values(iterable)

2019-04-22 Thread Chris Barker via Python-Dev
On Fri, Apr 12, 2019 at 10:20 AM Brett Cannon wrote: > >> This doesn't strike me as needing an optimization through a dedicated > method. > maybe a new dict mapping type -- "shared_dict" -- it would be used in places like the csv reader where it makes sense, but wouldn't impact the regular dict

Re: [Python-Dev] Concurrent.futures: no type discovery for PyCharm

2019-04-22 Thread Brett Cannon
On Sat, Apr 20, 2019 at 2:10 PM Inada Naoki wrote: > "import typing" is slow too. > But is it so slow as to not do the right thing here and use the 'typing' module as expected? If you have so much work you need to launch some threads or processes to deal with it then a single import isn't going