Thursday, June 4, 2009

PyCon 2009 Notes - March 28th

Day Two of the "core" of PyCon 2009...

Morning Lightning Talks

You’ll find the video at http://us.pycon.org/2009/conference/schedule/event/41/.

Jesse Noller’s “Python License V3” is pretty funny (http://blip.tv/file/1931026 contains only that talk).

http://blip.tv/file/1999383 contains all the Saturday morning lightning talks.

Katie Cunningham talks on Python at NASA at 19:15.

PlayerPiano (http://playerpiano.googlecode.com) pretend typing of doctests for demos at 35:15.

James Bennett had a good presentation on DVCSs at 40:10:

PyMite - a subset of Python for microcontrollers (at 45:15)

  • http://pymite.python-hosting.com
  • will run in as little as 64 KB flash and 4 KB RAM
  • easy porting: one file with six functions
  • interactive interface
  • easy to write native functions: embed C code in docstrings
  • to try it out:
    • svn co http://svn.pymite.python-hosting.com/trunk
    • cd trunk; make ipm
  • TODO - would be interesting to port it to Nios II

web2py (at 49:50)

  • admin interface not just for database, but for design & debug

Keynote: Guido van Rossum

You’ll find the video at http://us.pycon.org/2009/conference/schedule/event/42/.

The R-word

  • “I’m not retiring, but I’m tiring.”
  • doesn’t enjoy traveling like he used to
  • “I’m sort of thinking over the next five or ten years to gradually fade away.”
  • Hopes in 5 years that the BDFL is not actually leading the community anymore, more of a figurehead.
  • “Don’t look to me for guidance for everything.”

Mentioned a new PEP that he supports on “yield from” which is useful for building “coroutine libraries” [I think]

MAY be a dependency & packaging API in 2.7 & 3.1—he mentioned this problem several times, it’s certainly on his mind as a big unsolved problem

“Remember, once you put an API in the core, it may not be dead but it evolves at a glacial pace.” “Third-party packages can evolve much faster.”

“The standard library may be just the right size.”

  • Can’t shrink it without killing apps.
  • Don’t want to add things until they’re stable. “Biologists call things that are stable ‘dead’.”

Answering a question about code blocks: “Let’s stop tinkering with the languages and [focus on] solv[ing] the problems around the language.”

  • FOR FUTURE INVESTIGATION: Guido said you could put a decorator around a nested function that “says execute here” (@apply?) - would this be the equivalent of Ruby code blocks? What are the advantages of Ruby code blocks? How are they used? Would this apply to nested, apply-decorated functions like this?

Jacob Kaplan-Moss - The State of Django

You’ll find the slides (in PDF format) and video at http://us.pycon.org/2009/conference/schedule/event/45/. I didn’t take any notes. (And the slides aren’t meant to be read by themselves.)

Joe Gregorio - The (lack of) design patterns in Python

You’ll find the slides (in PDF format) at http://us.pycon.org/2009/conference/schedule/event/51/, but there’s no video yet. (I’ll update this when it appears.)

BTW, Joe Gregorio’s PyCon 2009 blog post is at http://bitworking.org/news/420/pycon-2009-notes. You’ll find links to his “An Introduction to Google App Engine” tutorial materials there (as well as mention of this talk).

This was one of my favorite talks from PyCon 2009.

Mythology - languages are all turing complete

Python isn’t Java without the compile

“Yes, design patterns are good, but they’re also a sign of weakness in a language.”

The patterns are built in [to Python].

  • “No one talks about the ‘structured programming’ pattern, or the ‘object-oriented’ pattern, or the ‘function’ pattern anymore.”

“When most of your code does nothing in a pompous way that is a sure sign that you are heading in the wrong direction. Here’s a translation into Python.”
- Peter Otten

Wikipedia Strategy Pattern page - “invisible in languages with first-class functions”.

no need for iterator pattern in Python

also talked about Abstract Factory pattern, and others

TODO - I need to think about his using a decorator for the observer pattern. (Slides 27 through 29.)

Conclusions:

  1. look to features before patterns
  2. reduce patterns -> shorter code
  3. needed patterns -> language feature

Concurrency Patterns listed on Wikipedia:

  • Thread pool, etc.
  • “do these point to language features we should be talking about adding?”

See the Google Video: “Advanced Topics in Programming Languages: Concurrency and Message Passing in Newsqueak” by Rob Pike

Jack Diederich - Class Decorators: Radically Simple

You find the slides (in PDF & PPT formats) and video at http://us.pycon.org/2009/conference/schedule/event/55/.

This was also one of my favorite talks from PyCon. I recommend you watch the video.

Practical definitions of a decorator:

  • takes one argument
  • returns something useful
Example:
import cron
@cron.schedule(cron.NIGHTLY)
class SalesReport(Report):
def run(self):
# do stuff
“Can do everything in class decorators that you can do in metaclasses” [I may have paraphrased.]
  • class decorators are explicit
  • class decorators are easily stackable (unlike metaclasses—while possible, it’s difficult to remember how)
  • nice alternative to mixins

Popular patterns:

  • register - like cron scheduler above
  • augment - like mixins
  • fixup
  • verify

very simple (and slick) registration class decorator - see slide 25

Best Practices

  • return the original class
  • don't assume you are the only decorator
  • maybe you want a metaclass [he still uses them sometimes]
  • don't add slots

Ed Leafe - Dabo: Rich Client Web Applications in 100% Python

Slides (in ODP format) and video at http://us.pycon.org/2009/conference/schedule/event/58/.

advantages of web application:

  • zero deployment
  • cross platform
  • centralized control (of databases)

disadvantages:

  • limited UI

Manifest Class

  • client and server diff each other, ala rsync

Dabo Springboard is a launch app (to allow you to run apps without have to install, so you get the same advantage as a browser-based app)

Bob Ippolito - Drop ACID and think about data

Video at http://us.pycon.org/2009/conference/schedule/event/64/. I found the slides at http://bitbucket.org/etrepum/drop_acid_pycon_2009/ (linked to from his "PyCon 2009, Drop ACID and think about data") blog post.

This was a "firehose-style" presentation, so I recommend you first have a look at the slides, then try the video if interested.

ACID

  • Atomicity - all or nothing
  • Consistency - no explosions
  • Isolation - no fights (when used concurrently)
  • Durability - no lying

networks make ACID difficult in a distributed environment (which is necessary for reliability and scalability)

BASE

  • basically available
  • soft state
  • eventually consistent

Then reviews the pros & cons of:

  • BigTable
  • Dynamo
  • Cassandra
  • Tokyo Cabinet & Tokyo Tyrant
  • Redis
  • CouchDB
  • MongoDB
  • Column Databases
  • MonetDB
  • LucidDB
  • Vertica
    • this is the one his company (MochiMedia) decided to pay for; “it works”

“Bloom Filters are Neat”

  • probabilistic data structure
  • false positives at a known error
  • constant space
  • uses:
    • approximate counting of a large set (eg. unique IPs from logs)
    • knowing that data is definitely NOT stored somewhere (eg. remote chache)

Ian Bicking - Topics of Interest

Video, slides, and IRC logs available at http://us.pycon.org/2009/conference/schedule/event/76/.

I went to this talk because I had heard Ian Bicking is a great speaker and is “not to be missed”. I’m afraid I wish I had missed it. Ian kept a live IRC display on the screen as he spoke. While it was good for some laughs, it was a distraction to both the speaker and the audience.

TODO - he mentioned a lot of names of what I presume are projects he’s started (he assumed—incorrectly in my case—that we all knew what they are), I should learn about them:

  • Paste
  • Deliverance
  • WebOb
  • PoachEggs
  • pip

Alex Martelli - Abstraction as Leverage

I chose the Ian Bicking talk over this one. The video and slides (PDF) are at http://us.pycon.org/2009/conference/schedule/event/75/.

TODO: I intend to review them. I’ve never regretted attending an Alex Martelli lecture.

Lennart Regebro - Python 2.6 and 3.0 compatibility

I chose the Ian Bicking talk over this one also. But this looks interesting: “This talks takes a look at the various options of migrating to Python 3, and takes up examples of some tricks you can do to make you code run unmodified under both 2.6 and 3.0.” The video and slides (PDF) are at http://us.pycon.org/2009/conference/schedule/event/74/.

Evening Lightning Talks

You’ll find the video at http://us.pycon.org/2009/conference/schedule/event/78/.

snakebite - http://www.snakebite.org/ (right at the start of the video)

  • “Snakebite is a network that strives to provide developers of open source projects complete and unrestricted access to as many different platforms, operating systems, architectures, compilers, devices, databases, tools and applications that they may need in order to optimally develop their software.”

reading and writing Excel files from Python (5:40)

melkjug.org (8:35)

  • for filtering RSS feeds
  • open source

funny numbers rant (15:55)

Martin v. Löwis talks about porting Django and pyscopg to Python 3.0 (32:30)

Leonard Reder from JPL spoke about “Mars Science Laboratory - Flight Software Automatic Code Generation Tools” (37:35)