[PATCH][BUG] BZR_PLUGIN_PATH='' loads from ~/.bzr.conf/plugins
Aaron Bentley
aaron.bentley at utoronto.ca
Mon Jun 27 16:23:05 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John A Meinel wrote:
> Harald Meland wrote:
>
>> Isn't this merely a verbose way of saying:
>>
>> bzrpath = os.environ.get('BZR_PLUGIN_PATH', DEFAULT_PLUGIN_PATH)
>>
>> ?
>>
>>
> That is what I thought, but that is how I had it, and Martin changed it.
> So I left it the way he had it, and just fixed the if statement.
There is actually a slight difference. Doing
os.environ.get('BZR_PLUGIN_PATH', None) means that if 'BZR_PLUGIN_PATH'
is defined, and its value is set to None, the result is the same as when
'BZR_PLUGIN_PATH' is not defined.
e.g.
a = {'me', None}
b = {}
assert a.get('me') == b.get('me')
assert a != b
del a['me']
assert a.get('me') == b.get('me')
assert a == b
Which, on the whole, is pretty weird. I guess to be paranoid, you either do
try:
a['me']
except KeyError:
foo
or
None2 = NoneType()
if a.get('me', None2) is None2:
foo
Anyhow, I have no idea whether Martin had this in mind, and I wouldn't
encourage treating "del a['me']" the same as "a['me'] = None"
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCwBnZ0F+nu1YWqI0RAgJ7AJ9VQ/igRpjVnT0ZWy332to1cfVJRQCfaMyJ
IRvlgUnNXZxPXV6GW1N2CeM=
=R8DF
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list