[Tutor] Making big 'uns into little 'uns

Ray Jones crawlzone at gmail.com
Thu Sep 6 16:50:30 CEST 2012

On 09/06/2012 07:35 AM, Jerry Hill wrote:
> On Thu, Sep 6, 2012 at 10:15 AM, Ray Jones <crawlzone at gmail.com> wrote:
>> Well, of all the.....   a REAL programming language..... I mean, even
>> Bash.... ;;))
>> Anyway, it was a shot. Thanks.
> There's almost certainly a way to accomplish your goal of simplifying
> your giant nested if statements.  It just doesn't involve pointers.
> Perhaps if you mocked up a representative example for us to look at
> and play with, someone could come up with a suggestion.
> For instance, if your set of if statements is emulating what would be
> done with a case statement in other languages, dictionary based
> dispatch may be a cleaner way to do the same thing in python.
Thanks for the reply, Jerry. I actually can do it relatively easily with
just a few nested 'if' statements.....I was trying multiple tests within
the same 'if' statement. I'm simplifying it by changing into a 0-based
loop rather than a 1-based loop (don't have to worry about the '-1'
stuff). I'm not certain where I'm going with it yet - it's a udacity
assignment that I'm still trying to work out in my head.


More information about the Tutor mailing list