Re: [Tutor] Where to put small auxiliary function

2012-07-20 Thread Steven D'Aprano
Jose Amoreira wrote: Hi. This is a question about style. I have a class definition that calls a small auxiliary function. Because this function isn't used anywhere else, I'd like to include it inside the class definition. *shrug* Then do so. class Whatever: @staticmethod def is_odd(

Re: [Tutor] Where to put small auxiliary function

2012-07-20 Thread Mark Lawrence
On 20/07/2012 12:20, Jose Amoreira wrote: Hi Mark, Thanks. [SNIP] Let me give an example: def is_odd(k): if k % 2 == 0: return False else: return True I'll point out before anyone else does that you can write this function as a one line return. I'll leave y

Re: [Tutor] Where to put small auxiliary function

2012-07-20 Thread Jose Amoreira
Hi Mark, Thanks. > [SNIP] >> Let me give an example: >> >> def is_odd(k): >> if k % 2 == 0: >> return False >> else: >> return True > > > I'll point out before anyone else does that you can write this function as a > one line return. I'll leave you to work out how. Pe

Re: [Tutor] Where to put small auxiliary function

2012-07-20 Thread Joel Goldstick
On Fri, Jul 20, 2012 at 6:32 AM, Mark Lawrence wrote: > On 20/07/2012 11:07, Jose Amoreira wrote: >> >> Hi. >> This is a question about style. I have a class definition that calls a >> small auxiliary function. Because this function isn't used anywhere >> else, I'd like to include it inside the cl

Re: [Tutor] Where to put small auxiliary function

2012-07-20 Thread Mark Lawrence
On 20/07/2012 11:07, Jose Amoreira wrote: Hi. This is a question about style. I have a class definition that calls a small auxiliary function. Because this function isn't used anywhere else, I'd like to include it inside the class definition. However, if I do that, I'll have to use "self" in the

[Tutor] Where to put small auxiliary function

2012-07-20 Thread Jose Amoreira
Hi. This is a question about style. I have a class definition that calls a small auxiliary function. Because this function isn't used anywhere else, I'd like to include it inside the class definition. However, if I do that, I'll have to use "self" in the call argument, which is (I think) rather awk