Re: [Python-ideas] add a time decorator to timeit.py

2018-10-10 Thread Anders Hovmöller
> On 7 Oct 2018, at 22:44, Guido van Rossum wrote: > > So someone ought to submit a PR that adds (brief) documentation for this, > with reference to this thread. I was trying to write this documentation when I noticed that the docs already mention this! "The stmt and setup parameters can

[Python-ideas] Paul Romer, 2018 Economics Nobel Laureate, uses Python and Jupyter

2018-10-10 Thread Jonathan Fine
Terry Reedy wrote (to comp.lang.python) > https://paulromer.net/jupyter-mathematica-and-the-future-of-the-research-paper/ > Jupyter, Mathematica, and the Future of the Research Paper > Paul Romer, new Nobel prize winner in economics, for research on how > ideas interact with economic growth,

Re: [Python-ideas] Paul Romer, 2018 Economics Nobel Laureate, uses Python and Jupyter

2018-10-10 Thread Geoffrey Spear
On Wed, Oct 10, 2018 at 11:29 AM Jonathan Fine wrote: > Terry Reedy wrote (to comp.lang.python) > > > > https://paulromer.net/jupyter-mathematica-and-the-future-of-the-research-paper/ > > Jupyter, Mathematica, and the Future of the Research Paper > > Paul Romer, new Nobel prize winner in

Re: [Python-ideas] async unittest.TestCase

2018-10-10 Thread Yury Selivanov
Thanks for proposing this. Yes, it makes sense to have unittest.AsyncTestCase in 3.8. AFAIK Lisa Roach (copied) was working on that (as well as on async Mock object), but I'm not sure what's the status of her work. I suggest to search for an open issue for this on bugs.python.org; if there's

[Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Philip Martin
Hi, I first want to thank everyone in the community for the contributions over the years. I know the idea of a frozendict has been proposed before and rejected. I have a use case for a frozendict implementation that to my knowledge was not discussed during previous debates. My reasoning for a

Re: [Python-ideas] async unittest.TestCase

2018-10-10 Thread Serhiy Storchaka
10.10.18 20:19, Yury Selivanov пише: Thanks for proposing this. Yes, it makes sense to have unittest.AsyncTestCase in 3.8. AFAIK Lisa Roach (copied) was working on that (as well as on async Mock object), but I'm not sure what's the status of her work. I suggest to search for an open issue for

Re: [Python-ideas] Paul Romer, 2018 Economics Nobel Laureate, uses Python and Jupyter

2018-10-10 Thread Jonathan Fine
Geoffrey Spear wrote: > Is there an idea for Python hidden somewhere in this message? Thank you, Geoffrey, for pointing this out. I'd have done better to prefixed the title with OFF-TOPIC. That would have been more polite. To answer your question: Django created a new community of Python users.

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread João Santos
One important difference between MappingProxyType and a "proper" frozendict, as analog to frozenset, is that MappingProxyType doesn't have any method to return mutated versions of itself. On Thu, 11 Oct 2018 at 01:24, Steven D'Aprano wrote: > Hi Philiip, and welcome, > > On Wed, Oct 10, 2018 at

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Anders Hovmöller
In tri.struct we have a class Frozen https://github.com/TriOptima/tri.struct/blob/master/lib/tri/struct/__init__.py that can be used to freeze stuff. I think something like this would be even better in the standard library, especially now with data classes! If we had this frozendict would just

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Serhiy Storchaka
11.10.18 07:20, João Santos пише: One important difference between MappingProxyType and a "proper" frozendict, as analog to frozenset, is that MappingProxyType doesn't have any method to return mutated versions of itself. MappingProxyType.copy()?

[Python-ideas] async unittest.TestCase

2018-10-10 Thread David Shawley
Hi everyone and good morning to some of you, Since asyncio and the async/await syntax are both part of Python, I think that we should extend TestCase to support it. The simplest solution that I can think of is to create unittest.AsyncTestCase sub-class with the following extensions: - create a

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Michael Selik
How does a frozendict help in that example? It's not obvious to me. Despite not understanding that example, I'm +1 for having a frozendict. I don't think it'll increase cognitive load much, as it'll sit right next to frozenset when someone reads the builtins in alphabetical order. In my own

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Steven D'Aprano
Hi Philiip, and welcome, On Wed, Oct 10, 2018 at 12:04:48PM -0500, Philip Martin wrote: > I generally have used MappingProxyType as a way to set default mapping > to a function or to set an empty mapping to a function. > I've created a gist with an example use case: > >

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Cameron Simpson
On 10Oct2018 20:25, Philip Martin wrote: Steven, that's a great idea, and I would be 100% up for your suggestion to have types.MappingProxyType renamed to frozendict. I'm not for the rename, myself. Though I'd not be against a frozendict factory in builtins, a tiny shim for MappingProxyType.

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Philip Martin
It would help over using a regular dict as a default argument to a function by preventing accidental mutation of the default or constant mapping. This is a quickly contrived example of the convert_price function now having a side effect by changing the translation_map. from unicodedata import

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Philip Martin
Steven, that's a great idea, and I would be 100% up for your suggestion to have types.MappingProxyType renamed to frozendict. However, the differences in the behavior of MappingProxyType's constructor versus dict's would make the API's behavior confusing IMO. For example, MappingProxyType(x=5,

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Philip Martin
Cameron, That's a good suggestion. Ultimately, if there are not enough various use cases for a frozendict class, I think we could add something like this as an example recipe similar to the recipe section in itertools. I would be hesitant to add a quick shim to the standard library as I can't

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Chris Angelico
On Thu, Oct 11, 2018 at 1:02 PM Cameron Simpson wrote: > > On 10Oct2018 20:25, Philip Martin wrote: > >Steven, that's a great idea, and I would be 100% up for your suggestion to > >have types.MappingProxyType renamed to frozendict. > > I'm not for the rename, myself. Though I'd not be against a

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Philip Martin
That is interesting. From my recollection, when OrderedDict was reimplemented in C, there was advice on the thread to not implement it as a subclass of dict. https://bugs.python.org/issue16991 I'm far from the right person to comment on the exact reasons, but perhaps frozenset being decoupled