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(
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
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
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
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
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