[Tutor] Actual code that illustrates problem

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Aug 17 20:58:36 CEST 2006


>>>> # face = [x,y,0]
>>> [some code cut]
>>>> # face[0] = x
>>>> # face[1] = y
>>>> # face[2] = 0
>
> I agree.  I reasoned as follows.
>
> The root cause is that Python is not returning the correct value of a list.
>
> So before I return the list, I will remind Python what's in the list.

Hi Kermit,

Let's take those last three assignments out: they don't do anything as far 
as I can see.  If you do see a functional change in your program after 
doing so, I'll be very surprised and intrigued.  *grin*

The reason for taking them out is to, again, make the program as short 
and sweet as we can for humans to read.  A program's readability matters.


> Ok.  I will work on splitting up the rest of strong fac into a set of 
> functions.

That sounds good!  Definitely keep us up-to-date while you do it.  We can 
give suggestions if we see something that can be simplified, and we want 
to make sure you don't run into any big ruts as you do this.

Once your program is in smaller functional chunks, let's look again at 
your original problem.  I'm hoping that it'll be easier to chase the 
problem down then.


> I will attempt to maintain a compromise between having too many levels 
> of function calls and having any one function be too long.

I wouldn't worry about having heavy function call depth too much yet.  If 
it does turn out to be an issue, reversing the refactoring by inlining 
should be mechanically easy to do.


Good luck to you!


More information about the Tutor mailing list