Re: [Python-Dev] async __setitem__

2015-06-21 Thread Guido van Rossum
On Sun, Jun 21, 2015 at 12:48 AM, Greg Ewing wrote: > Nick Coghlan wrote: > >> What if we're assigning to >> multiple targets, do the run in parallel? How is tuple unpacking >> handled? How is augmented assignment handled? >> >> If we allow asynchronous assignment, do we allow asynchronous deleti

Re: [Python-Dev] async __setitem__

2015-06-20 Thread Greg Ewing
Nick Coghlan wrote: What if we're assigning to multiple targets, do the run in parallel? How is tuple unpacking handled? How is augmented assignment handled? If we allow asynchronous assignment, do we allow asynchronous deletion as well? Yeah, we'd kind of be letting the camel's nose in here.

Re: [Python-Dev] async __setitem__

2015-06-20 Thread Yury Selivanov
Hi Martin, Actually, I think that it's better to adopt a bit different design: async with db.transaction(): table[key1] = 'a' table[key2] = 'b' And then, in __aexit__ you should flush the updates to the database in bulk. Usually, when working with an ORM, you need to update mo

Re: [Python-Dev] async __setitem__

2015-06-20 Thread Nick Coghlan
On 19 June 2015 at 22:56, Martin Teichmann wrote: > to get something out of the database. But getting something in, I have > to write something like > > await table.set(key, value) > > It would be cool if I could just write > > await table[key] = value You've introduced an ambiguity here,

[Python-Dev] async __setitem__

2015-06-19 Thread Martin Teichmann
Hi everyone, I was really happy to see PEP 492 - that is really a big step forward. It makes many programming constructs possible in combination with asyncio, which have been cumbersome or impossible until now. One thing that still is impossible is to have __setitem__ be used asynchronously. As a