Thanks, probably you are right, hacking python in my situation is not
neccessary...
>Jan Procházka wrote:
>
>
>
>>can have modules special methods?
>>
>>
>
>no, but you can replace the module object with something that can have
>special methods:
>
>$ more module.py
>import sys
>
>class Modu
Jan Procházka wrote:
> can have modules special methods?
no, but you can replace the module object with something that can have
special methods:
$ more module.py
import sys
class Module:
def __getitem__(self, value):
return value
sys.modules[__name__] = Module()
$ python
>>> impor
Hello,
can have modules special methods?
althouht i think that no, i tried following example and i don't, why it
don't works:
file m2.py (imported module)
class Module:
def __getitem__(self,index):
return index
module=Module()
__getitem__=module.__getitem