PEP 526 - var annotations and the spirit of python

Chris Angelico rosuav at gmail.com
Thu Jul 5 03:05:30 EDT 2018


On Thu, Jul 5, 2018 at 4:58 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>> Optimize for readability, not writability.
>
> And that is why we all hold COBOL up as the paragon of excellence for a
> programming language! *wink*
>
> Or if you don't like COBOL, how about Hypertalk?
>
> put 42 into x
> ask file "Which file would you like to open?" with "default.txt"
> if it is empty exit to Hypercard
> put it into thefile
> open file thefile
> repeat with num = 1 to x
>   write "spam" to file thefile
> end repeat
> close file thefile
>

Using Chai and Mocha to test a Node.js web app ends up looking a bit
like that, actually. You perform a request, then make assertions:

expect(res).to.be.json;
expect(res.body).to.be.an(object);
expect(res.body.stuff).to.be.an(array);
expect(res.body.stuff).to.have.length(5);

etc etc etc.

ChrisA



More information about the Python-list mailing list