Re: [Python-ideas] __iter__(), keys(), and the mapping protocol

2018-09-12 Thread Michael Selik
The dict keys method has other benefits beyond iteration. For example, it provides a set-like interface. On Wed, Sep 12, 2018, 10:50 PM Elias Tarhini wrote: > On Wed, Sep 12, 2018 at 4:42 PM Michael Selik wrote: > >> You want to have a Mapping that does not supply a keys method? What use >>

Re: [Python-ideas] __iter__(), keys(), and the mapping protocol

2018-09-12 Thread Elias Tarhini
On Wed, Sep 12, 2018 at 4:42 PM Michael Selik wrote: > You want to have a Mapping that does not supply a keys method? What use > case motivated your proposal? > Yes, my proposal was to consider allowing __iter__() to subsume keys() entirely, for the reasons outlined in my second email -- which

Re: [Python-ideas] PTPython REPL in IDLE

2018-09-12 Thread Anders Hovmöller
>> Have y’all seen ptpython’s autocomplete and syntax highlighting >> features? > > No. Do you have a link? What specific features have excited you? IPython autocomplete is now powered by ptpython and Jedi. So if you’ve used it recently you’re already familiar with it. In the context of

Re: [Python-ideas] Python dialect that compiles into python

2018-09-12 Thread David Teresi
Not totally convinced about this. It would require PEP writers  to fully implement their proposed feature, people can usually get a pretty good idea of how a feature is supposed to work through PEPs (most of which are extremely well written), and these "mods" wouldn't be used in production code

Re: [Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code

2018-09-12 Thread Michael Selik
On Sat, Sep 8, 2018 at 4:17 AM Jonathan Fine wrote: > I thank Steve D'Aprano for pointing me to this real-life (although > perhaps extreme) code example > > > https://github.com/Tinche/aiofiles/blob/master/aiofiles/threadpool/__init__.py#L17-L37 It's hard to know from just a brief glance how

Re: [Python-ideas] __iter__(), keys(), and the mapping protocol

2018-09-12 Thread Michael Selik
Elias, I'm a little confused about what you're suggesting. You want to have a Mapping that does not supply a keys method? What use case motivated your proposal? On Mon, Sep 10, 2018, 7:04 PM Elias Tarhini wrote: > This has been bouncing around in my head for a while regarding the > requisite

Re: [Python-ideas] PTPython REPL in IDLE

2018-09-12 Thread Steven D'Aprano
On Wed, Sep 12, 2018 at 05:15:51PM -0400, James Lu wrote: > Have y’all seen ptpython’s autocomplete and syntax highlighting > features? No. Do you have a link? What specific features have excited you? The standard Python REPL now comes with autocomplete turned on by default. How does that

[Python-ideas] PTPython REPL in IDLE

2018-09-12 Thread James Lu
Have y’all seen ptpython’s autocomplete and syntax highlighting features? Ptpython, usually used as a cli application, might be worth integrating into IDLE. ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Steve Barnes
On 12/09/2018 16:38, Steven D'Aprano wrote: > On Wed, Sep 12, 2018 at 03:58:25PM +0100, Jonathan Fine wrote: > >> My question is about correctly implementing of __params__ as a keyword >> identifier, with semantics as in Steve B's code snippet above. > > The semantics of Steve's code snippet

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Steven D'Aprano
On Wed, Sep 12, 2018 at 03:58:25PM +0100, Jonathan Fine wrote: > My question is about correctly implementing of __params__ as a keyword > identifier, with semantics as in Steve B's code snippet above. The semantics of Steve's code snippet are ambiguous. > Here's my question: Do you think

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Steven D'Aprano
On Wed, Sep 12, 2018 at 06:59:44AM -0700, Ethan Furman wrote: > On 09/12/2018 05:17 AM, Steven D'Aprano wrote: [...] > >We could solve this race condition with locking, or by making the pair > >of steps: [...] > >I'm not an expert on threaded code, so it is possible I've missed some >

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Jonathan Fine
Hi Steve Thank you for your prompt reply. You wrote: > I'll confess that I couldn't work out what Steve B's code snippet was > supposed to mean: > params = {k:v for k,v in __params__ if k in parent.a_method.keys()} The Zen of Python (which might not apply here) says: In the face of

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Steven D'Aprano
On Wed, Sep 12, 2018 at 02:23:34PM +0100, Jonathan Fine wrote: > Steve Barnes suggested adding __params__, as in > > > def a_method(self, cr, uid, ids, values, context=None): > >... > >params = {k:v for k,v in __params__ if k in parent.a_method.keys()} > ># Possibly

[Python-ideas] Off-topic: Email with content: Cannot read property 'get' of null

2018-09-12 Thread Jonathan Fine
This is off-topic, but you might enjoy reading it. I got an email today, whose entire body text was Cannot read property 'get' of null It reminded me of our discussions of None-aware operators. And also Errors should never pass silently. Unless explicitly silenced. -- Jonathan

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Ethan Furman
On 09/12/2018 05:17 AM, Steven D'Aprano wrote: > Indeed. Each time you call locals(), it returns a new dict with a snapshot of the current local namespace. Because it all happens inside the same function call, no external thread can poke inside your current call to mess with your local

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Jonathan Fine
Steve Barnes suggested adding __params__, as in > def a_method(self, cr, uid, ids, values, context=None): >... >params = {k:v for k,v in __params__ if k in parent.a_method.keys()} ># Possibly add some additional entries here! >super(self,

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Anders Hovmöller
> On 8 Sep 2018, at 14:23, Anders Hovmöller wrote: > >> To me, the "30% of all arguments" deserves more careful examination. >> Does the proposal significant improve the reading and writing of this >> code? And are there other, perhaps better, ways of improving this >> code? > > Maybe my tool

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Steven D'Aprano
On Tue, Sep 11, 2018 at 04:57:16PM +0100, Jonathan Fine wrote: > Summary: locals() and suggestion __params__ are similar, and roughly > speaking each can be implemented from the other. You cannot get a snapshot of the current locals just from the function parameters, since the current locals

Re: [Python-ideas] __iter__(), keys(), and the mapping protocol

2018-09-12 Thread Alex Walters
> -Original Message- > From: Python-ideas list=sdamon@python.org> On Behalf Of Serhiy Storchaka > Sent: Tuesday, September 11, 2018 2:54 AM > To: python-ideas@python.org > Subject: Re: [Python-ideas] __iter__(), keys(), and the mapping protocol > > 11.09.18 05:04, Elias Tarhini