Asynchronous programming

Michael Selik michael.selik at gmail.com
Thu Aug 11 11:51:13 EDT 2016


On Thu, Aug 11, 2016 at 11:46 AM Michael Selik <michael.selik at gmail.com>
wrote:

> On Thu, Aug 11, 2016 at 11:01 AM Steven D'Aprano <
> steve+python at pearwood.info> wrote:
>
>> That ... looks wrong. You're taking something which looks like a procedure
>> in the first case (trn.execute), so it probably returns None, and yielding
>> over it. Even it that's not wrong, and it actually returned something
>> which
>> you ignored in the first case
>>
>
> It's a standard, perhaps a mistaken standard, but nonetheless database
> cursors tend to have that feature: execute returns the mutated self. I
> agree that execute looks like it should return None instead. The return
> self pattern feels Rubyish to me (or Rubic?).
>

Contradicting myself:
    yield from c.execute(query).fetchall()    # looks good
    yield from c.execute(query)                   # looks bad



More information about the Python-list mailing list