Re: Avoiding if..elsif statements

2006-08-27 Thread Tal Einat
Fredrik Lundh wrote: > Tal Einat wrote: > > > This will work great if all of your functions recieve the same > > argument(s). > > I assumed "every single function would be passing the same variables" > meant exactly that, of course. > > Right, as usual. I sort of missed that... ;) - Tal -- h

Re: Avoiding if..elsif statements

2006-08-27 Thread Fredrik Lundh
Tal Einat wrote: > This will work great if all of your functions recieve the same > argument(s). I assumed "every single function would be passing the same variables" meant exactly that, of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding if..elsif statements

2006-08-27 Thread Tal Einat
Fredrik Lundh wrote: > "unexpected" <[EMAIL PROTECTED]> wrote: > > > However, I'm passing in a few variables, so I can't just take it > > out-though every single function would be passing the same variables. > > > > so something.func() is actually > > something.func(string, list) > > > > How would

Re: Avoiding if..elsif statements

2006-08-26 Thread Ghalib Suleiman
Try it and see. Functions are first-class citizens in Python. On Aug 25, 2006, at 6:36 PM, unexpected wrote: > I have a program where based on a specific value from a dictionary, I > call a different function. Currently, I've implemented a bunch of > if..elsif statements to do this, but it's gott

Re: Avoiding if..elsif statements

2006-08-25 Thread Carl Banks
unexpected wrote: > Currently, I've implemented a bunch of > if..elsif statements to do this, but it's gotten to be over 30 right > now and has gotten rather tedious. Is there a more efficient way to do > this? Use something other than Perl. :) Carl Banks -- http://mail.python.org/mailman/lis

Re: Avoiding if..elsif statements

2006-08-25 Thread Daniel Nogradi
> Code: > > value = self.dictionary.get(keyword)[0] > > if value == "something": > somethingClass.func() > elsif value == "somethingElse": > somethingElseClass.func() > elsif value == "anotherthing": > anotherthingClass.func() > elsif value == "yetanotherthing": > yetanotherthingCla

Re: Avoiding if..elsif statements

2006-08-25 Thread Fredrik Lundh
"unexpected" <[EMAIL PROTECTED]> wrote: > However, I'm passing in a few variables, so I can't just take it > out-though every single function would be passing the same variables. > > so something.func() is actually > something.func(string, list) > > How would I modify it to include them? just add

Re: Avoiding if..elsif statements

2006-08-25 Thread unexpected
the missing () was the trick! However, I'm passing in a few variables, so I can't just take it out-though every single function would be passing the same variables. so something.func() is actually something.func(string, list) How would I modify it to include them? Sorry I didn't include them the

Re: Avoiding if..elsif statements

2006-08-25 Thread Chaz Ginger
unexpected wrote: > I have a program where based on a specific value from a dictionary, I > call a different function. Currently, I've implemented a bunch of > if..elsif statements to do this, but it's gotten to be over 30 right > now and has gotten rather tedious. Is there a more efficient way to

Re: Avoiding if..elsif statements

2006-08-25 Thread Simon Forman
unexpected wrote: > I have a program where based on a specific value from a dictionary, I > call a different function. Currently, I've implemented a bunch of > if..elsif statements to do this, but it's gotten to be over 30 right > now and has gotten rather tedious. Is there a more efficient way to

Re: Avoiding if..elsif statements

2006-08-25 Thread Fredrik Lundh
"unexpected" <[EMAIL PROTECTED]> wrote: > I have a program where based on a specific value from a dictionary, I > call a different function. Currently, I've implemented a bunch of > if..elsif statements to do this, but it's gotten to be over 30 right > now and has gotten rather tedious. Is there a

Avoiding if..elsif statements

2006-08-25 Thread unexpected
I have a program where based on a specific value from a dictionary, I call a different function. Currently, I've implemented a bunch of if..elsif statements to do this, but it's gotten to be over 30 right now and has gotten rather tedious. Is there a more efficient way to do this? Code: value = s