[IPython-dev] Status of pre-0.10 reviews and merges
Jörgen Stenarson
jorgen.stenarson at bostream.nu
Wed Apr 1 13:37:03 EDT 2009
Oops forgot to send this to list as well:
Brian Granger skrev:
> Hi,
>
> Things have gone quite for a while now and I wanted to see where we
> stand on getting ready for 0.10. There are 7 merge proposals listed
> here:
>
> https://code.launchpad.net/ipython/+activereviews
>
> Of these 4 seem to be in process and 3 are in need of review.
>
> What is the status of the 4 branches that have already been reviewed,
> but are in need to fixing and/or further review?
>
I have looked at and commented on all those that do not have status
"needs fixing".
Some random thoughts on the refactoring process:
When working on the genutils.py patch I thought that it would be nice to
have smaller module files because it is somewhat difficult to navigate
huge modules and sometimes it can be difficult to guess in what module I
should look for some function.
All uses of from xx import * should be removed. This is one refactoring
that would really benefit from good test coverage.
To simplify debugging I have found the following idiom useful when
re-raising exceptions because it preserves the full traceback:
import sys
def a():
1/0
def b():
try:
a()
except ZeroDivisionError, x:
raise ValueError, None, sys.exc_info()[2]
def c():
try:
a()
except ZeroDivisionError, x:
raise ValueError
From an interactive session after running the prop_traceback.py script:
In [1]: b()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
C:\python\<ipython console> in <module>()
C:\python\prop_traceback.py in b()
9 def b():
10 try:
---> 11 a()
12 except ZeroDivisionError, x:
13 raise ValueError, None, sys.exc_info()[2]
C:\python\prop_traceback.py in a()
5
6 def a():
----> 7 1/0
8
9 def b():
ValueError:
In [2]: c()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
C:\python\<ipython console> in <module>()
C:\python\prop_traceback.py in c()
16 a()
17 except ZeroDivisionError, x:
---> 18 raise ValueError
19
20
ValueError:
As you can see when calling b() we get the full traceback up to the a
function unlike in c() where the traceback terminates in the except
cluse. I have found this technique very useful when debugging code. I do
not know in what way this will affect performance or if there are any
other drawbacks in threaded code or elsewhere...
/Jörgen
More information about the IPython-dev
mailing list