Creative Commons Licence This work is licensed under a Creative Commons
Attribution-ShareAlike 4.0 International License

Source: gitlab

Snake in Python 3 + Qt 5

Andy Balaam
artificialworlds.net/blog

Contents

Snake

Python

Python

"Executable pseudo-code"

names = "Bob", "Jill"

for name in names:
    print( name )

Python 3

The big unicode fix

Python 3

Iterators everywhere

for i in range( 10 ): # No list is created
    print( i )

More comprehensions

print( { i: i*i for i in range( 10 ) } )

# prints:
# {0: 0, 1: 1, 2: 4, 3: 9}

Python 3

New string formatting

msg = "Score: {0}".format( score )

Or using names

msg = "Score: {foo}".format( foo=score )

Python 3

Tidying

Qt

Qt

Qt

Very complete

Qt 5

Good bits (Python 3)

Good bits (Qt)

Bad bits (Python)

Context: 12,000-line type-heavy Python 2 project, plus lots of smaller projects

Bad bits (Qt 5)

Context: totally new to Qt

Donate

Donate! patreon.com/andybalaam

Play

Play! artificialworlds.net/rabbit-escape

More info

Videos youtube.com/user/ajbalaam
Twitter @andybalaam
Blog artificialworlds.net/blog
Projects artificialworlds.net