Yelp/mrjob — Issue #229: protocols should be instances by default
Author: davidmarin
Created: 2011-10-08 01:59:46+00:00
State: open

mrjob v0.3 should allow anything with `read()` and `write()` methods to work as a protocol.

So far, protocols have been classes and `read()`/`write()` have been `classmethods`. This should still work, but we should assume most protocols are now instances. This would allow you to tweak the behavior of protocols without making a new class for every possible behavior (e.g. to set character set).

`MRJob` should have an `input_protocol()`, `internal_protocol()`, and `output_protocol()` method, which you can re-define, which returns an instance.

It should also have a quick way to specify a protocol class with the `INPUT_PROTOCOL`, `INTERNAL_PROTOCOL`, and `OUTPUT_PROTOCOL` attributes. These should be a classes (actually, callables) so we're not running code at import time.