module confusion
Michael Spencer
mahs at telcopartners.com
Wed Oct 3 14:21:59 EDT 2007
+1 Subject line of the week (SLOTW)
rjcarr wrote:
> So my question is ... why are they [os.path and logging.handlers] different?
[A] wrote:
> Because you misspelled it. First, do a dir() on logging:
[B] wrote:
> No, he didn't... OP: logging is a package and logging.handlers is one module
> in the package... os.path is a particularly weird case...
[C] wrote:
> You can't import packages, only modules.
[D] wrote:
> Oh come on, this is unnecessary nitpicking.
[E] wrote:
> You *can* import a package, and a package is just a *little* different from a
> module
[B] wrote:
> Yes, but os.path is also module. That's why I said it was a weird case.
[C] wrote:
> You can't have modules within modules. os.path isn't an exception...It's just
> a variable that happens to point to the posixpath module.
[F] wrote:
> There's no "pointing" going on. It's another name bound to the same object,
> of equal status to the 'posixpath' name.
[G] wrote:
> a module is just an object, that can of course be an attribute of another
> module object
[H] wrote:
> os is not a package; os.path is set when the os module is imported
[C] wrote:
> You're right. I was misremembering the behaviour of PyCrypto
[J] wrote:
> In Matlab you can use function dec2bin, hex2dec, dec2hex bin2dec functions to
> convert decimal to binary and heximal etc.
[B] wrote:
> I believe that is precisely what I was saying.
with apologies to all concerned :-)
Michael
More information about the Python-list
mailing list