[RFC] Transport hints
John Arbash Meinel
john at arbash-meinel.com
Sun Jul 23 13:41:26 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've been thinking about both sftp and http lately, and how we want to
make customized get requests.
For sftp, we want to do a get() while disabling prefetch, and for http,
we want to do one while disabling automatic following of redirects.
Ultimately, this means we need to parameterize Transport.get() so that
we can pass these flags. And I realized, I don't really want to add a
new public parameter, which then all transports need to implement, even
if they just ignore it.
I realized that a 'hints' parameter would satisfy this nicely. By
calling it 'hints', it makes it clear that it isn't strictly required,
just a hint as to what should be done.
I've thought about doing it two ways:
def get(relpath, **hints):
versus
def get(relpath, hints={}):
Then all transports just need to add one more field, which they treat as
a dict that they can extract hints from.
My question is, which way would be better? I prefer the syntax of the
former, mostly because it is shorter, and easier to type:
a_transport.get(relpath, prefetch=False)
versus
a_transport.get(relpath, hints={'prefetch':False})
However, I kind of like that the later is more obvious that we are
giving a hint.
Anyone have a particular preference?
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD4DBQFEw252JdeBCYSNAAMRAj53AJ42JpQoFN4h+EheqIxseEZrPnprRgCWOLSW
j9VswbSNAyEy1qUQuJZmbA==
=DPpR
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list