On Fri, Nov 07, 2003, Raymond Hettinger wrote: > > For example, zlib_codec.py can then express its encoding function as: > > def zlib_encode(input,errors='strict', **kwds): > assert errors == 'strict' > if 'level' in kwds: > output = zlib.compress(input, kwds['level']) > else: > output = zlib.compress(input) > return (output, len(input)) > > The user can then have access to zlib's optional compression level > argument: > > >>> 'which witch has which witches wristwatch'.encode('zlib', level=9) Change this to def zlib_encode(input,errors='strict', opts=None): if opts: if 'level' in opts: ... >>> 'which witch has which witches wristwatch'.encode('zlib', {'level':9}) and I'm +1. Otherwise I'm somewhere around -0; I agree with Barry about possible pollution. This change is a small inconvenience for greater decoupling. opts could be an instance instead, but I think a straight dict probably makes the most sense. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "It is easier to optimize correct code than to correct optimized code." --Bill Harlan
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4