Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#63: We're still on a desktop GUI kick

Published Thu, Feb 1, 2018, recorded Wed, Jan 31, 2018

Sponsored by DigitalOcean: http://do.co/python

Brian #1: A brief tour of Python 3.7 data classes

  • a great write-up of the upcoming data classes via Anthony Shaw
  • “Data classes are a way of automating the generation of boiler-plate code for classes which store multiple properties. They also carry the benefit of using Python 3’s new type hinting.”
  • Default magic methods
    • In the default setting, any dataclass will implement __init__, __repr__, __str__ and __eq__ for you.
    • The __init__ method will have keyword-arguments with the same type annotations that are specified on the class.
    • The __eq__ method will compare all dataclass attributes in order.
    • All fields are declared at the top of the class and type hinting is required.
  • Also covered
    • type hinting
    • mutability (and frozen)
    • customizing the fields
    • post-init processing : optional __``*post_init_*``_ will run after the generated _``*_init_*``_
    • inheritance

Michael #2: SQLite [The Databaseology Lectures - CMU Fall 2015]

Brian #3: dryable : a useful dry-run decorator for python

  • short circuit methods within your project during dry runs.
  • example shows how to add a command line flag --dry-run.
  • The test code is useful for understanding it also.
  • Example something.py import dryable

    @dryable.Dryable('foo') def return_something(): return 'something'

test_something.py

from something import return_something
import dryable

def test_normal_return():
    dryable.set(False) 
    assert return_something() == 'something'

def test_dry_return(capsys):
    dryable.set(True) 
    assert return_something() == 'foo'

Michael #4:

Brian #5: PEP Explorer - Explore Python Enhancement Proposals

  • Cool idea. Might need some work though. I can’t find any accepted PEPs for 3.7, including 557, data classes.
  • I’m ok with giving Anthony some shade on this, as we highlighted his writing in the first item.

Michael #6: TKInter Tutorial

  • via @likegeeks
  • Create your first GUI application
  • Create a label and button widgets
  • Input and combo boxs, menus, progressbars and more

Our news

Michael

  • I built something with Gooey this weekend, it was wonderful.
  • Self-serve team purchases and discounts at Talk Python Training

Want to go deeper? Check our projects