From jep200404 at columbus.rr.com Wed Dec 6 14:38:29 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Wed, 6 Dec 2017 14:38:29 -0500 Subject: [CentralOH] 2017-12-11 December Technical Meeting Announcement: Test Driven Development (TDD) Message-ID: <20171206143829.6a1a94a8.jep200404@columbus.rr.com> December Technical Meeting Announcement December 11, 2017, 6:00 p.m. 18:00 Pillar Technology's 'The Forge'[1] at the Smith Brothers' Hardware Building 20:00 Brazenhead Irish Pub[2] Come and learn, share, grow, meet new people, and visit old friends at our monthly meeting! We'll be talking about the Python programming language and anything that intersects it, and the cool stuff you can do with it. This month Jim Prior will give a presentation on Test Driven Development (TDD) with pytest[3]. It will be very interactive with much audience participation. It will start with tdd-demo[4] and then start over from scratch for some simple program. Friends don't let friends use unittest[5]. This is the first time we will have a technical meeting in December. This technical meeting is in addition to the 2017-12-04 social meeting. It is on the second Monday to avoid conflicts with Thanksgiving, Christmas, and New Year's Day. Thanks much to Pillar and Christoph for hosting us. Later, around 8pm, we will go to Brazenhead Irish Pub on Fifth Ave for more socializing, food, and beverages. [1] Pillar Technology's 'The Forge' http://www.openstreetmap.org/way/32866361#map=17/39.97482/-82.99765 [2] Brazenhead http://www.hdrestaurants.com/brazenhead/5thavenue/ http://www.openstreetmap.org/node/506852587 [3] https://docs.pytest.org/en/latest/ [4] https://github.com/james-prior/tdd-demo Please review and submit issues and/or pull requests. [5] https://docs.python.org/3/library/unittest.html From eric at intellovations.com Wed Dec 6 15:33:36 2017 From: eric at intellovations.com (Eric Floehr) Date: Wed, 6 Dec 2017 15:33:36 -0500 Subject: [CentralOH] 2017-12-11 December Technical Meeting Announcement: Test Driven Development (TDD) In-Reply-To: <20171206143829.6a1a94a8.jep200404@columbus.rr.com> References: <20171206143829.6a1a94a8.jep200404@columbus.rr.com> Message-ID: RSVP Here: https://www.meetup.com/Central-Ohio-Python-Users-Group/events/245705538/ On Wed, Dec 6, 2017 at 2:38 PM, wrote: > December Technical Meeting Announcement > > December 11, 2017, 6:00 p.m. > > 18:00 Pillar Technology's 'The Forge'[1] at the Smith Brothers' > Hardware Building > > 20:00 Brazenhead Irish Pub[2] > > Come and learn, share, grow, meet new people, and visit old > friends at our monthly meeting! We'll be talking about the > Python programming language and anything that intersects it, > and the cool stuff you can do with it. > > This month Jim Prior will give a presentation on Test > Driven Development (TDD) with pytest[3]. It will be very > interactive with much audience participation. It will start > with tdd-demo[4] and then start over from scratch for some > simple program. Friends don't let friends use unittest[5]. > > This is the first time we will have a technical meeting in > December. This technical meeting is in addition to the > 2017-12-04 social meeting. It is on the second Monday to > avoid conflicts with Thanksgiving, Christmas, and New Year's > Day. > > Thanks much to Pillar and Christoph for hosting us. > > Later, around 8pm, we will go to Brazenhead Irish Pub on > Fifth Ave for more socializing, food, and beverages. > > [1] Pillar Technology's 'The Forge' > http://www.openstreetmap.org/way/32866361#map=17/39.97482/-82.99765 > > [2] Brazenhead > http://www.hdrestaurants.com/brazenhead/5thavenue/ > http://www.openstreetmap.org/node/506852587 > > [3] https://docs.pytest.org/en/latest/ > > [4] https://github.com/james-prior/tdd-demo > Please review and submit issues and/or pull requests. > > [5] https://docs.python.org/3/library/unittest.html > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Fri Dec 8 15:28:02 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 8 Dec 2017 15:28:02 -0500 Subject: [CentralOH] 3 Days Away: TDD Presentation Message-ID: <20171208152802.0f43c885.jep200404@columbus.rr.com> 3 Days Away: There will be a presentation on Test Driven Development Monday. Like was done for dojo changes, I should send redundant notices for this meeting scheduled on the unusual date of the second Monday. December Technical Meeting Announcement December 11, 2017, 6:00 p.m. 18:00 Pillar Technology's 'The Forge'[1] at the Smith Brothers' Hardware Building 20:00 Brazenhead Irish Pub[2] Come and learn, share, grow, meet new people, and visit old friends at our monthly meeting! We'll be talking about the Python programming language and anything that intersects it, and the cool stuff you can do with it. This month Jim Prior will give a presentation on Test Driven Development (TDD) with pytest[3]. It will be very interactive with much audience participation. It will start with tdd-demo[4] and then start over from scratch for some simple program. Friends don't let friends use unittest[5]. This is the first time we will have a technical meeting in December. This technical meeting is in addition to the 2017-12-04 social meeting. It is on the second Monday to avoid conflicts with Thanksgiving, Christmas, and New Year's Day. Thanks much to Pillar and Christoph for hosting us. Later, around 8pm, we will go to Brazenhead Irish Pub on Fifth Ave for more socializing, food, and beverages. Please RSVP[6] so our generous host knows how much pizza to order. [1] Pillar Technology's 'The Forge' http://www.openstreetmap.org/way/32866361#map=17/39.97482/-82.99765 [2] Brazenhead http://www.hdrestaurants.com/brazenhead/5thavenue/ http://www.openstreetmap.org/node/506852587 [3] https://docs.pytest.org/en/latest/ [4] https://github.com/james-prior/tdd-demo Please review and submit issues and/or pull requests. [5] https://docs.python.org/3/library/unittest.html [6] https://www.meetup.com/Central-Ohio-Python-Users-Group/events/245705538/ From jep200404 at columbus.rr.com Sat Dec 9 21:37:08 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sat, 9 Dec 2017 21:37:08 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-07_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gcGFpciBwcm9ncmFtbWluZyBwcmFjdGljZTsgZWFm?= =?utf-8?q?p_v_lbyl=3B_Python_for_Scientists_and_Engineers=3B_Python_Testi?= =?utf-8?q?ng_with_pytest=3B_practical_math?= Message-ID: <20171209213708.45e1e729.jep200404@columbus.rr.com> https://github.com/james-prior/20171207-dojo-fizzbuzz-pair-programming-practice.git EAFP versus LBYL http://nbviewer.jupyter.org/github/james-prior/cohpy/blob/master/20170424-cohpy-lbyl-v-eafp.ipynb https://github.com/james-prior/cohpy/blob/master/20170424-cohpy-lbyl-v-eafp.ipynb highly recommends: Python for Scientists and Engineers by Shantu Tiwari http://pythonforengineers.com/pythonforengineersbook/ https://leanpub.com/pythonforengineers huh?: Retired This book is no longer available for sale. https://github.com/shantnu/PythonForEngineersTheBook seems moribund: last updated 2017-05-14 https://www.scribd.com/document/251131422/Python-for-Scientists-and-Engin-Shantnu-Tiwari highly recommended: Python Testing with pytest by brian okken https://pragprog.com/book/bopytest/python-testing-with-pytest wp:Complex_number#Applications wp:Imaginary unit wp:Phasor#Phasor_arithmetic wp:? wp:Leonhard Euler wp:Euler's identity A poll of readers conducted by The Mathematical Intelligencer in 1990 named Euler's identity as the "most beautiful theorem in mathematics". wp:Erd?s number ------------------------------------------------------------------------------- link farm Top 15 resources for learning JavaScript https://opensource.com/article/17/12/learn-javascript 10 must-read DevOps resources https://opensource.com/article/17/12/10-must-read-devops-books What DevOps teams really need from a CIO https://enterprisersproject.com/article/2017/12/what-devops-teams-really-need-cio From jep200404 at columbus.rr.com Sat Dec 9 21:41:12 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Sat, 9 Dec 2017 21:41:12 -0500 Subject: [CentralOH] 2 Days Away: TDD Presentation In-Reply-To: <20171208152802.0f43c885.jep200404@columbus.rr.com> References: <20171208152802.0f43c885.jep200404@columbus.rr.com> Message-ID: <20171209214112.75806d15.jep200404@columbus.rr.com> 2 Days Away: On Monday, there will be a presentation on Test Driven Development. https://www.meetup.com/Central-Ohio-Python-Users-Group/events/245705538/ Like was done for dojo changes, I should send redundant notices for this meeting scheduled on the unusual date of the second Monday. From jep200404 at columbus.rr.com Mon Dec 11 11:16:39 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Mon, 11 Dec 2017 11:16:39 -0500 Subject: [CentralOH] Meeting Today Message-ID: <20171211111639.0b63cd66.jep200404@columbus.rr.com> Today! The presentation is on Test Driven Development. It will be very interactive. We will likely do the work on one computer hooked up to the big displays, with one volunteer typing on it, with little incremental steps coming from the audience with guidance from the presenter. No preparation is needed, other than a little Python knowledge. RSVP https://www.meetup.com/Central-Ohio-Python-Users-Group/events/245705538/ From jep200404 at columbus.rr.com Fri Dec 15 18:14:24 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 15 Dec 2017 18:14:24 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-14_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gaW5vdGlmeSBvbiBvc3g7IHBhcmFtZXRyaXplIHR1?= =?utf-8?q?ples_versus_dict=3B_pytest_color=3B_red_green_show=3B_unittest_?= =?utf-8?q?versus_pytest=3B_dvorak_and_pytest?= Message-ID: <20171215181424.40e7b4fb.jep200404@columbus.rr.com> What do OSX folks use instead of inotify to automatically run tests? while inotifywait -r -e modify src tests; do make make check cat tests/test-suite.log done @pytest.mark.parametrize: collection of tuples versus dictionary using a dictionary inherently suggests input versus output. keys suggest input values suggest output Someone who showed at CARPE a USB powered BRIGHT LED light is interested in having it integrated with unit tests to show the status in BRIGHT red or BRIGHT green. tdd-demo base py.test -f --color=yes . pytest -f --color=yes . friends don't let friends use unittest https://www.slant.co/versus/9148/9149/~unittest_vs_pytest Why I use py.test and you probably should too http://halfcooked.com/presentations/pyconau2013/why_I_use_pytest.html ========================= wp:recursion nested lists https://docs.python.org/3.1/library/itertools.html#itertools.chain How many for loops can one nest in Python? Why does Python have a limit on the number of static blocks that can be nested? https://stackoverflow.com/questions/44972719/why-does-python-have-a-limit-on-the-number-of-static-blocks-that-can-be-nested two folks practiced pair programming and tdd on fizzbuzz wp:Anton?n Dvo??k wp:Symphony No. 9 (Dvo??k) wp:August Dvorak wp:QWERTY https://en.wikipedia.org/wiki/File:KB_South_Korea.svg what is the dvorak version for (???? wp:Dubeolsik#Dubeolsik What do you get when you combine Dvorak with pytest? Python Testing with pytest https://pragprog.com/book/bopytest/python-testing-with-pytest Katharine! but you can qwerty with pytest https://github.com/james-prior/configuration-files wp:The Red Green Show red green refactor https://ifttt.com/blink1 Separating Programming Sheep from Non-Programming Goats https://blog.codinghorror.com/separating-programming-sheep-from-non-programming-goats/ https://docs.pytest.org/en/latest/builtin.html should write own pytest.approx() just for fun: class that overloads comparison functions modify @pytest.mark.parametrize decorator: if there is only one argument, presume that tuple is a named tuple and get variable names from the named tuple Bad Code https://xkcd.com/ duct tape of the internet: 10 useful ncat (nc) Command Examples for Linux Systems https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/ https://www.merriam-webster.com/dictionary/well https://www.merriam-webster.com/dictionary/good Minors, Foreigners to Be Banned from Bitcoin Trade http://english.chosun.com/site/data/html_dir/2017/12/14/2017121401208.html How to Search PDF Files from the Terminal with pdfgrep https://www.maketecheasier.com/search-pdf-files-pdfgrep/ Build a game framework with Python using the Pygame module https://opensource.com/article/17/12/game-framework-python From deeptinker at fastmail.com Fri Dec 15 18:39:17 2017 From: deeptinker at fastmail.com (Travis Risner) Date: Fri, 15 Dec 2017 18:39:17 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-14_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gaW5vdGlmeSBvbiBvc3g7IHBhcmFtZXRyaXplIHR1?= =?utf-8?q?ples_versus_dict=3B_pytest_color=3B_red_green_show=3B_unittest_?= =?utf-8?q?versus_pytest=3B_dvorak_and_pytest?= In-Reply-To: <20171215181424.40e7b4fb.jep200404@columbus.rr.com> References: <20171215181424.40e7b4fb.jep200404@columbus.rr.com> Message-ID: <5A345D25.1070902@fastmail.com> For equivalent functionality on OSX, use fswatch. See https://stackoverflow.com/questions/1515730/is-there-a-command-like-watch-or-inotifywait-on-the-mac. Travis jep200404 at columbus.rr.com wrote: > What do OSX folks use instead of inotify to automatically run tests? > > while inotifywait -r -e modify src tests; do > make > make check > cat tests/test-suite.log > done > > @pytest.mark.parametrize: > > collection of tuples versus dictionary > > using a dictionary inherently suggests input versus output. > > keys suggest input > values suggest output > > Someone who showed at CARPE a USB powered BRIGHT LED light > is interested in having it integrated with unit tests > to show the status in BRIGHT red or BRIGHT green. > > tdd-demo base > > py.test -f --color=yes . > pytest -f --color=yes . > > friends don't let friends use unittest > > https://www.slant.co/versus/9148/9149/~unittest_vs_pytest > > Why I use py.test and you probably should too > http://halfcooked.com/presentations/pyconau2013/why_I_use_pytest.html > > ========================= > > wp:recursion > nested lists > https://docs.python.org/3.1/library/itertools.html#itertools.chain > How many for loops can one nest in Python? > Why does Python have a limit on the number of static blocks that can be nested? > https://stackoverflow.com/questions/44972719/why-does-python-have-a-limit-on-the-number-of-static-blocks-that-can-be-nested > > two folks practiced pair programming and tdd on fizzbuzz > > wp:Anton?n Dvo??k > wp:Symphony No. 9 (Dvo??k) > wp:August Dvorak > wp:QWERTY > https://en.wikipedia.org/wiki/File:KB_South_Korea.svg > what is the dvorak version for (???? > wp:Dubeolsik#Dubeolsik > > What do you get when you combine Dvorak with pytest? > > Python Testing with pytest > https://pragprog.com/book/bopytest/python-testing-with-pytest > Katharine! > > but you can qwerty with pytest > > https://github.com/james-prior/configuration-files > > wp:The Red Green Show > red green refactor > https://ifttt.com/blink1 > > Separating Programming Sheep from Non-Programming Goats > https://blog.codinghorror.com/separating-programming-sheep-from-non-programming-goats/ > > https://docs.pytest.org/en/latest/builtin.html > > should write own pytest.approx() just for fun: > class that overloads comparison functions > > modify @pytest.mark.parametrize decorator: > if there is only one argument, > presume that tuple is a named tuple > and get variable names from the named tuple > > Bad Code > https://xkcd.com/ > > duct tape of the internet: > > 10 useful ncat (nc) Command Examples for Linux Systems > https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/ > > https://www.merriam-webster.com/dictionary/well > https://www.merriam-webster.com/dictionary/good > > Minors, Foreigners to Be Banned from Bitcoin Trade > http://english.chosun.com/site/data/html_dir/2017/12/14/2017121401208.html > > How to Search PDF Files from the Terminal with pdfgrep > https://www.maketecheasier.com/search-pdf-files-pdfgrep/ > > Build a game framework with Python using the Pygame module > https://opensource.com/article/17/12/game-framework-python > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh -- Sent by Travis Risner From jep200404 at columbus.rr.com Mon Dec 18 15:13:03 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Mon, 18 Dec 2017 15:13:03 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-11_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz86IFRlc3QgRHJpdmVuIERldmVsb3BtZW50?= Message-ID: <20171218151303.33751476.jep200404@columbus.rr.com> Thanks to Pillar and Christoph for their generous hospitality. There was plenty of pizza and beverages for everyone. We had our first ever December technical meeting. Even though the meeting was announced only five days before the meeting, we had at least a couple dozen folks. Jim Prior gave an introduction to test driven development. It started out slow, but after the prerequisites were covered, it picked up and became very interactive as hoped with the tests and code coming from the audience. There were disagreements and misunderstandings which led to real learning. Thanks to everybody to participated. Neil Ludban's contribution still has me thinking about what the most readable code is. Who is the audience? A novice or Pythonista? return output or str(n) Thanks to John Cassidy for operating the computer. The code is on the 20171211-fizzbuzz branch: https://github.com/james-prior/tdd-demo/tree/20171211-fizzbuzz --- https://github.com/james-prior/tdd-demo/tree/master too coarse: does too much in one big step following have better granularity: https://github.com/james-prior/20171207-dojo-fizzbuzz-pair-programming-practice https://github.com/james-prior/pillar-kata-roman-numeral-calculator/ Test Driven Development: By Example by Kent Beck examples are not in Python Test-Drive Development with Python by Harry J.W. Percival Obey the Testing Goat: Using Django, Selenium, and Javascript uses unittest, not pytest From nludban at columbus.rr.com Tue Dec 19 09:51:44 2017 From: nludban at columbus.rr.com (Neil Ludban) Date: Tue, 19 Dec 2017 09:51:44 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-11_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz86IFRlc3QgRHJpdmVuIERldmVsb3BtZW50?= In-Reply-To: <20171218151303.33751476.jep200404@columbus.rr.com> References: <20171218151303.33751476.jep200404@columbus.rr.com> Message-ID: <20171219095144.c71fa86e2f8c99c24b056158@columbus.rr.com> On Mon, 18 Dec 2017 15:13:03 -0500 jep200404 at columbus.rr.com wrote: ... > most readable code is. Who is the audience? A novice or Pythonista? > > return output or str(n) > Or this way may be preferred if learning modern Python: return output if output else str(n) https://docs.python.org/2.5/whatsnew/pep-308.html The oddity of an apparently boolean expression evaluating to the original value instead of a boolean has been around a while, eg: http://www.perlmonks.org/?node_id=301355 From joe at decafjoe.com Tue Dec 19 21:14:23 2017 From: joe at decafjoe.com (Joe Joyce) Date: Tue, 19 Dec 2017 21:14:23 -0500 Subject: [CentralOH] Feedback on a New Package Message-ID: Hello all! Long time listener, first time caller. Love the show :P. So -- I built a thing. And if any of you have time over the holiday break, I'd appreciate any feedback you have. The code / docs are in the usual places: https://github.com/decafjoe/clik https://clik.readthedocs.io https://pypi.python.org/pypi/clik There are two "levels" of feedback I'm looking for. First, I've been in the forest so long on this thing that I'm not sure whether the tutorial explains the concepts well, if at all. It all makes sense to me, of course, but it's impossible for me to look at it with a fresh set of eyes. So -- not considering whether the library itself sucks -- does the tutorial explain things well? Is the pace appropriate? Too much detail / too little? Second, any feedback on the library itself is welcome. This is the first "real" thing I've released into the world, but I'll try not to be too sensitive! I'm curious (and a honestly a little afraid) about what y'all will think. Thanks, and happy holidays! Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From winningham at gmail.com Wed Dec 20 11:25:50 2017 From: winningham at gmail.com (Thomas Winningham) Date: Wed, 20 Dec 2017 11:25:50 -0500 Subject: [CentralOH] Feedback on a New Package In-Reply-To: References: Message-ID: Very minor item from a quick look. The Quick start section seems to be about building the project. While exceptionally complete content, I was expecting something like a simplified version of the example code, say, how do I make a --help option or how do I get a filename name as the first argument into a function that opens the file. Otherwise, nicely done with having all the resources and such as the documentation and the package submission all ready to go. Pretty clean and clear!! On Dec 20, 2017 9:23 AM, "Joe Joyce" wrote: Hello all! Long time listener, first time caller. Love the show :P. So -- I built a thing. And if any of you have time over the holiday break, I'd appreciate any feedback you have. The code / docs are in the usual places: https://github.com/decafjoe/clik https://clik.readthedocs.io https://pypi.python.org/pypi/clik There are two "levels" of feedback I'm looking for. First, I've been in the forest so long on this thing that I'm not sure whether the tutorial explains the concepts well, if at all. It all makes sense to me, of course, but it's impossible for me to look at it with a fresh set of eyes. So -- not considering whether the library itself sucks -- does the tutorial explain things well? Is the pace appropriate? Too much detail / too little? Second, any feedback on the library itself is welcome. This is the first "real" thing I've released into the world, but I'll try not to be too sensitive! I'm curious (and a honestly a little afraid) about what y'all will think. Thanks, and happy holidays! Joe _______________________________________________ CentralOH mailing list CentralOH at python.org https://mail.python.org/mailman/listinfo/centraloh -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at decafjoe.com Sat Dec 23 09:00:46 2017 From: joe at decafjoe.com (Joe Joyce) Date: Sat, 23 Dec 2017 09:00:46 -0500 Subject: [CentralOH] Feedback on a New Package In-Reply-To: References: Message-ID: Thomas, Thank you for the quick feedback! It's exactly the sort of thing I was looking for. I've been munching on it the last couple days, thoughts below. First -- duh. The instant I looked at the docs after reading your message, I saw exactly what you're talking about. The links under "Development" are documents about how to build/test/QA clik itself. But that is not *at all* clear! (Unless, err... you happened to have been the one who wrote that section like a month ago and haven't thought about it much since....) Second -- sigh. Quickstart/introductory documentation was/is a major struggle with clik. > how do I make a --help option or how do I get a filename name as the > first argument into a function that opens the file For a real-world program the answer is "just use argparse" -- clik provides nothing but an extra dependency to hassle with. clik doesn't really start to help out until/unless the program is more complex (namely: once it grows subcommands). So I've felt that, to make a compelling case for clik, the example code fundamentally has to be complex. That's why the tutorial is thirteen friggin' steps, and 52m in screencast form. But that's an unsatsifying answer. Expecting new users to make that kind of investment of time and mental energy on a first-pass evaluation is INSANE. I'm not totally sure what the answer is. But you're right, I need to bridge that gap. Also, there is a more specific answer to your example question. See below :). import sys from clik import app, args, parser def do_a_thing_with_a_filename(filename): pass @app def myapp(): """ This sentence and the next will be between the usage statement and the argument docs. If you're familiar with argparse, it's the ``description``. All the content after the first blank line is shown after the argument docs. In argparse terms, it's the ``epilog``. Note that argparse will reformat your documentation, so this is not a good place for things like examples that require formatting. """ # Note: The -h/--help argument is automatically added by argparse. # clik provides the ``name`` (for the usage statement), # ``description`` and ``epilog`` to argparse. Description # and epilog are taken from the function docstring, as # described above. The ``name`` defaults to the function's # name, but can be overridden by calling the decorator as # follows: @app(name='other-name') parser.add_argument( '-f', '--filename', help='filename to pass to the function', ) yield if args.filename is None: print('please provide a filename', file=sys.stderr) yield 1 do_a_thing_with_a_filename(args.filename) if __name__ == '__main__': myapp.main() Thanks again for your feedback! Joe On Wed, Dec 20, 2017 at 11:25 AM, Thomas Winningham wrote: > Very minor item from a quick look. The Quick start section seems to be > about building the project. While exceptionally complete content, I was > expecting something like a simplified version of the example code, say, how > do I make a --help option or how do I get a filename name as the first > argument into a function that opens the file. > > Otherwise, nicely done with having all the resources and such as the > documentation and the package submission all ready to go. Pretty clean and > clear!! > > On Dec 20, 2017 9:23 AM, "Joe Joyce" wrote: > > Hello all! > > Long time listener, first time caller. Love the show :P. > > So -- I built a thing. And if any of you have time over the holiday > break, I'd appreciate any feedback you have. > > The code / docs are in the usual places: > > https://github.com/decafjoe/clik > https://clik.readthedocs.io > https://pypi.python.org/pypi/clik > > There are two "levels" of feedback I'm looking for. > > First, I've been in the forest so long on this thing that I'm not sure > whether the tutorial explains the concepts well, if at all. It all > makes sense to me, of course, but it's impossible for me to look at it > with a fresh set of eyes. > > So -- not considering whether the library itself sucks -- does the > tutorial explain things well? Is the pace appropriate? Too much detail > / too little? > > Second, any feedback on the library itself is welcome. This is the > first "real" thing I've released into the world, but I'll try not to > be too sensitive! I'm curious (and a honestly a little afraid) about > what y'all will think. > > Thanks, and happy holidays! > Joe > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nludban at columbus.rr.com Sat Dec 23 09:36:02 2017 From: nludban at columbus.rr.com (Neil Ludban) Date: Sat, 23 Dec 2017 09:36:02 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-11_=E6=9C=83=E8=AD=B0_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz86IFRlc3QgRHJpdmVuIERldmVsb3BtZW50?= In-Reply-To: <20171219095144.c71fa86e2f8c99c24b056158@columbus.rr.com> References: <20171218151303.33751476.jep200404@columbus.rr.com> <20171219095144.c71fa86e2f8c99c24b056158@columbus.rr.com> Message-ID: <20171223093602.e563ddf7035dba5d2f7eb245@columbus.rr.com> On Tue, 19 Dec 2017 09:51:44 -0500 Neil Ludban wrote: > On Mon, 18 Dec 2017 15:13:03 -0500 > jep200404 at columbus.rr.com wrote: > ... > > most readable code is. Who is the audience? A novice or Pythonista? > > > > return output or str(n) > > See also SQL's coalesce function: https://www.postgresql.org/docs/9.5/static/functions-conditional.html#FUNCTIONS-COALESCE-NVL-IFNULL From erik.n.welch at gmail.com Sat Dec 23 11:53:26 2017 From: erik.n.welch at gmail.com (Erik Welch) Date: Sat, 23 Dec 2017 10:53:26 -0600 Subject: [CentralOH] Feedback on a New Package In-Reply-To: References: Message-ID: btw, the name clik is very close to another fairly well known and popular CLI package click (from the creator of flask): http://click.pocoo.org/ Anyway, thanks for developing and sharing clik! --Erik On Sat, Dec 23, 2017 at 8:00 AM, Joe Joyce wrote: > Thomas, > > Thank you for the quick feedback! It's exactly the sort of thing I was > looking for. I've been munching on it the last couple days, thoughts > below. > > First -- duh. The instant I looked at the docs after reading your > message, I saw exactly what you're talking about. The links under > "Development" are documents about how to build/test/QA clik itself. > But that is not *at all* clear! (Unless, err... you happened to have > been the one who wrote that section like a month ago and haven't > thought about it much since....) > > Second -- sigh. Quickstart/introductory documentation was/is a major > struggle with clik. > > > how do I make a --help option or how do I get a filename name as the > > first argument into a function that opens the file > > For a real-world program the answer is "just use argparse" -- clik > provides nothing but an extra dependency to hassle with. clik doesn't > really start to help out until/unless the program is more complex > (namely: once it grows subcommands). > > So I've felt that, to make a compelling case for clik, the example > code fundamentally has to be complex. That's why the tutorial is > thirteen friggin' steps, and 52m in screencast form. > > But that's an unsatsifying answer. Expecting new users to make that > kind of investment of time and mental energy on a first-pass > evaluation is INSANE. > > I'm not totally sure what the answer is. But you're right, I need to > bridge that gap. > > Also, there is a more specific answer to your example question. > See below :). > > import sys > > from clik import app, args, parser > > > def do_a_thing_with_a_filename(filename): > pass > > > @app > def myapp(): > """ > This sentence and the next will be between the usage statement and > the argument docs. If you're familiar with argparse, it's the > ``description``. > > All the content after the first blank line is shown after the > argument docs. In argparse terms, it's the ``epilog``. Note that > argparse will reformat your documentation, so this is not > a good place for things like examples that require formatting. > """ > > # Note: The -h/--help argument is automatically added by argparse. > # clik provides the ``name`` (for the usage statement), > # ``description`` and ``epilog`` to argparse. Description > # and epilog are taken from the function docstring, as > # described above. The ``name`` defaults to the function's > # name, but can be overridden by calling the decorator as > # follows: @app(name='other-name') > > parser.add_argument( > '-f', > '--filename', > help='filename to pass to the function', > ) > > yield > > if args.filename is None: > print('please provide a filename', file=sys.stderr) > yield 1 > > do_a_thing_with_a_filename(args.filename) > > > if __name__ == '__main__': > myapp.main() > > > Thanks again for your feedback! > Joe > > > On Wed, Dec 20, 2017 at 11:25 AM, Thomas Winningham > wrote: > >> Very minor item from a quick look. The Quick start section seems to be >> about building the project. While exceptionally complete content, I was >> expecting something like a simplified version of the example code, say, how >> do I make a --help option or how do I get a filename name as the first >> argument into a function that opens the file. >> >> Otherwise, nicely done with having all the resources and such as the >> documentation and the package submission all ready to go. Pretty clean and >> clear!! >> >> On Dec 20, 2017 9:23 AM, "Joe Joyce" wrote: >> >> Hello all! >> >> Long time listener, first time caller. Love the show :P. >> >> So -- I built a thing. And if any of you have time over the holiday >> break, I'd appreciate any feedback you have. >> >> The code / docs are in the usual places: >> >> https://github.com/decafjoe/clik >> https://clik.readthedocs.io >> https://pypi.python.org/pypi/clik >> >> There are two "levels" of feedback I'm looking for. >> >> First, I've been in the forest so long on this thing that I'm not sure >> whether the tutorial explains the concepts well, if at all. It all >> makes sense to me, of course, but it's impossible for me to look at it >> with a fresh set of eyes. >> >> So -- not considering whether the library itself sucks -- does the >> tutorial explain things well? Is the pace appropriate? Too much detail >> / too little? >> >> Second, any feedback on the library itself is welcome. This is the >> first "real" thing I've released into the world, but I'll try not to >> be too sensitive! I'm curious (and a honestly a little afraid) about >> what y'all will think. >> >> Thanks, and happy holidays! >> Joe >> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> https://mail.python.org/mailman/listinfo/centraloh >> >> > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > https://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jep200404 at columbus.rr.com Tue Dec 26 16:52:34 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Tue, 26 Dec 2017 16:52:34 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-21_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gcmVndWxhciBleHByZXNzaW9uczsgRFJZIHJlZmFj?= =?utf-8?q?toring?= Message-ID: <20171226165234.32e9ecfd.jep200404@columbus.rr.com> Full tables tonight Someone saw: Mastering Regular Expressions, 3rd Edition By Jeffrey Friedl at Half-Price Book on Lane Avenue for $22.49 thought the folks at the dojo would be interested, then remembered that the dojo was going on right then and went to it, albeit very late It was gone the next day. There was some code that included something like the following. Fun was had refactoring it. def __repr__(self): s = sorted(self.properties.keys()) results = [] for key in s: value = self.properties[key] if isinstance(value, str): results.append('{}: "{}"'.format(key, value)) else: results.append('{}: {}'.format(key, value)) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Iterate over key value pairs. def __repr__(self): s = sorted(self.properties.items()) results = [] for key, value in s: if isinstance(value, str): results.append('{}: "{}"'.format(key, value)) else: results.append('{}: {}'.format(key, value)) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Get rid of the temporary variable s. def __repr__(self): results = [] for key, value in sorted(self.properties.items()): if isinstance(value, str): results.append('{}: "{}"'.format(key, value)) else: results.append('{}: {}'.format(key, value)) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Use repr() to quote strings, instead of hardcoding '"' for quoting. repr() correcly quotes strings that have quotes and wierd characters in them. This changes behavior. def __repr__(self): results = [] for key, value in sorted(self.properties.items()): if isinstance(value, str): results.append('{}: {}'.format(key, repr(value))) else: results.append('{}: {}'.format(key, value)) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Use repr() for non-strings also. def __repr__(self): results = [] for key, value in sorted(self.properties.items()): if isinstance(value, str): results.append('{}: {}'.format(key, repr(value))) else: results.append('{}: {}'.format(key, repr(value))) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Eliminate the superfluous if/else. def __repr__(self): results = [] for key, value in sorted(self.properties.items()): results.append('{}: {}'.format(key, repr(value))) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Use !r in format string instead of explicit repr() call. def __repr__(self): results = [] for key, value in sorted(self.properties.items()): results.append('{}: {!r}'.format(key, value)) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Convert loop to list comprehension. This was made much easier by eliminating the if/else statements. def __repr__(self): results = [ '{}: {!r}'.format(key, value) for key, value in sorted(self.properties.items()) ] if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' A collection (such as a list) is true if it has anything in it, otherwise it is false. This allows one to test for somethingness / emptiness of a collection without using len() as other languages require. def __repr__(self): results = [ '{}: {!r}'.format(key, value) for key, value in sorted(self.properties.items()) ] if results: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Rearrange last return statement to be more like next to last return statement def __repr__(self): results = [ '{}: {!r}'.format(key, value) for key, value in sorted(self.properties.items()) ] if results: return 'Something: {}'.format(', '.join(results)) else: return 'Something: {}'.format('empty') Use "or" operator to eliminate if / else statements. (Neil's "or" not Neils Bohr) def __repr__(self): results = [ '{}: {!r}'.format(key, value) for key, value in sorted(self.properties.items()) ] return 'Something: {}'.format(', '.join(results) or 'empty') Use temporary variable for readability. def __repr__(self): results = [ '{}: {!r}'.format(key, value) for key, value in sorted(self.properties.items()) ] key_value_pairs_string = ', '.join(results) return 'Something: {}'.format(key_value_pairs_string or 'empty') Use simpler C-style formatting. def __repr__(self): results = [ '{}: {!r}'.format(key, value) for key, value in sorted(self.properties.items()) ] key_value_pairs_string = ', '.join(results) return 'Something: %s' % (key_value_pairs_string or 'empty') Use simpler C-style formatting again. def __repr__(self): results = [ '%s: %r' % (key, value) for key, value in sorted(self.properties.items()) ] key_value_pairs_string = ', '.join(results) return 'Something: %s' % (key_value_pairs_string or 'empty') Rename a variable for readability. def __repr__(self): key_value_strings = [ '%s: %r' % (key, value) for key, value in sorted(self.properties.items()) ] key_value_pairs_string = ', '.join(key_value_strings) return 'Something: %s' % (key_value_pairs_string or 'empty') Make output more robust by using repr() for keys. This changes behavior. def __repr__(self): key_value_strings = [ '%r: %r' % (key, value) for key, value in sorted(self.properties.items()) ] key_value_pairs_string = ', '.join(key_value_strings) return 'Something: %s' % (key_value_pairs_string or 'empty') Leave key value pair as a tuple def __repr__(self): key_value_strings = [ '%r: %r' % key_value for key_value in sorted(self.properties.items()) ] key_value_pairs_string = ', '.join(key_value_strings) return 'Something: %s' % (key_value_pairs_string or 'empty') Compare the above with the original code below. no if/else statements DRY Which is easier to understand? What would you change to make it easier to understand? def __repr__(self): s = sorted(self.properties.keys()) results = [] for key in s: value = self.properties[key] if isinstance(value, str): results.append('{}: "{}"'.format(key, value)) else: results.append('{}: {}'.format(key, value)) if len(results) > 0: return 'Something: {}'.format(', '.join(results)) else: return 'Something: empty' Does any of the code work? =============================================================================== link farm How to add a player to your Python game https://opensource.com/article/17/12/game-python-add-a-player Calendar Facts https://xkcd.com/1930/ Using Pygame to move your game character around https://opensource.com/article/17/12/game-python-moving-player From jep200404 at columbus.rr.com Fri Dec 29 20:22:06 2017 From: jep200404 at columbus.rr.com (jep200404 at columbus.rr.com) Date: Fri, 29 Dec 2017 20:22:06 -0500 Subject: [CentralOH] =?utf-8?q?2017-12-28_=E9=81=93=E5=A0=B4_Scribbles_?= =?utf-8?b?76SY5pu4L+aDoeaWhz8gdGRkIGFnYWluIHdpdGggZml6emJ1eno=?= Message-ID: <20171229202206.1d8ba7fe.jep200404@columbus.rr.com> did tdd intro with fizzbuzz again How to use PostgreSQL to streamline Python code https://opensource.com/article/17/12/python-and-postgresql wp:Entity?relationship model wp:Entity-relationship_diagram argouml https://modeling-languages.com/uml-tools/#UML_tools_for_Python