Re: Why Python forbids multiple instances of one module?

2010-07-07 Thread CHEN Guang
Why Python forbids multiple instances of one module? If only Python allows multiple instances of one module, module will be enough to replace class in most cases. After all, it is much easier to write a module than a class, at least we do not have to write self everywhere. If you really

Re: Why Python forbids multiple instances of one module?

2010-07-06 Thread kedra marbun
module obj is instance of types.ModuleType, which is instance of 'type', where class obj is instance of 'type'. even only at this point, they're diff in to many ways. there are so many things to do when you truly want module to replace class, as pointed by 2 posts above i'm also a beginner, so i

Why Python forbids multiple instances of one module?

2010-07-04 Thread CHEN Guang
Why Python forbids multiple instances of one module? If only Python allows multiple instances of one module, module will be enough to replace class in most cases. After all, it is much easier to write a module than a class, at least we do not have to write self everywhere. -- http

Re: Why Python forbids multiple instances of one module?

2010-07-04 Thread Ian Kelly
2010/7/4 CHEN Guang dr...@126.com: Why Python forbids multiple instances of one module? If only Python allows multiple instances of one module, module will be enough to replace class in most cases. After all, it is much easier to write a module than a class, at least we do not have to write

Re: Why Python forbids multiple instances of one module?

2010-07-04 Thread Chris Rebert
2010/7/4 CHEN Guang dr...@126.com: Why Python forbids multiple instances of one module? That's just how its import mechanism works. It allows for modules that need canonical program-wide state to rely on being singleton, and it's also an optimization. You can trick the import machinery and get