This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients jnoller, ncoghlan
Date 2008-08-18.13:27:12
SpamBayes Score 1.901478e-08
Marked as misclassified No
Message-id <1219066045.43.0.199498522059.issue3589@psf.upfronthosting.co.za>
In-reply-to
Content
The package level imports from the new multiprocessing package exhibit
some very strange behaviour because they are actually functions
pretending to be classes:

Python 2.6b1+ (trunk:64945, Jul 14 2008, 20:00:46)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing as mp
>>> isinstance(mp.Lock(), mp.Lock)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes
and types
>>> mp.Lock.__name__
'Lock'
>>> mp.Lock.__module__
'multiprocessing'
>>> mp.Lock().__class__.__name__
'Lock'
>>> mp.Lock().__class__.__module__
'multiprocessing.synchronize'

The delayed import functions in multiprocessing.__init__ look like a
serious misfeature to me. I'd be inclined to replace them with "from
.synchronize import *" and "from .process import *" (leaving anything
which isn't covered by those two imports to be retrieved directly from
the relevant mp submodule)
History
Date User Action Args
2008-08-18 13:27:25ncoghlansetrecipients: + ncoghlan, jnoller
2008-08-18 13:27:25ncoghlansetmessageid: <1219066045.43.0.199498522059.issue3589@psf.upfronthosting.co.za>
2008-08-18 13:27:13ncoghlanlinkissue3589 messages
2008-08-18 13:27:12ncoghlancreate