summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-01-13 19:25:20 +0000
committerAlec Warner <antarus@gentoo.org>2007-01-13 19:25:20 +0000
commit3e8a638793af3b001843055e8928cdb79e8afb79 (patch)
treee70a10ae0a11bc094db9abf2b66d797f9af41429 /DEVELOPING
parentmake sure people call addread/addwrite/adddeny/addpredict correctly (diff)
downloadportage-multirepo-3e8a638793af3b001843055e8928cdb79e8afb79.tar.gz
portage-multirepo-3e8a638793af3b001843055e8928cdb79e8afb79.tar.bz2
portage-multirepo-3e8a638793af3b001843055e8928cdb79e8afb79.zip
fix tabs with patch from Grobian and bug # 161911, fix developing a bit
svn path=/main/trunk/; revision=5633
Diffstat (limited to 'DEVELOPING')
-rw-r--r--DEVELOPING12
1 files changed, 4 insertions, 8 deletions
diff --git a/DEVELOPING b/DEVELOPING
index 0530d99c..01eb9bd4 100644
--- a/DEVELOPING
+++ b/DEVELOPING
@@ -56,16 +56,12 @@ Generally you can do two things here, if you are messing with defaults..
dict.get(foo, some_default)
will try to retrieve foo from dict, if there is a KeyError, will insert foo
-into dict with the value of some_default. This method is preferred in most cases.
-
-You can also do something like:
+into dict with the value of some_default. This method is preferred in cases where
+you are messing with defaults:
try:
dict[foo]
- ...stuff here..
except KeyError:
- print "holy cow we totally expected a keyerror here"
+ dict[foo] = default_value
-in most instances however you are only catching the KeyError to set a default,
-in which case you should be using dict.get() or telling the user they are missing
-a required dict key.
+The get call is nicer (compact) and faster (try,except are slow).