Negroup - wrote:
> 2005/11/29, Kent Johnson <[EMAIL PROTECTED]>:
>>class A:
>> def __init__(self, limit):
>>self.limit = limit
>>self.num = 20
>> def info(self):
>>return self.limit
>> def inc_num(self):
>>self.num += 1
>> def check(self):
>>return self.num > self.limit
>>
>
2005/11/29, Kent Johnson <[EMAIL PROTECTED]>:
> Negroup - wrote:
[cut]
> Obviously this doesn't do what you want. The problem is that class A is
> seeing the limit defined in it's module. 'global' variables in Python
> actually have module scope, there is no truly global scope in Python (OK,
>
Negroup - wrote:
> Hi.
> Suppose that I need to use in my project a module that belongs to
> another project, because - with some tuning - it can fit my needings.
>
> module.py
> limit = 30
>
> class A:
> def __init__(self):
> self.num = 20
> def info(self):
> return limit
> def inc
Hi.
Suppose that I need to use in my project a module that belongs to
another project, because - with some tuning - it can fit my needings.
This is what I mean, with an example:
module.py
limit = 30
class A:
def __init__(self):
self.num = 20
def info(self):
return limit
def inc_num