On Fri, Jul 12, 2002 at 12:06:25PM -0400, Jeremy Hylton wrote:
I recently wrote some code that needed to look for functions. I wrote it this way:
from new import function
if isinstance(obj, function): # ...
It didn't look odd at all. And I don't care much where I import function from. I wouldn't mind if all the type objects defined in new where available in types. IOW, the names exported by new could also be exported by types.
That's exactly what PEP 294 proposed. The primary objection was that the documentation for the types module says that names exported by future versions will all end in "Type". People that do 'from types import *' based on this promise will tend to get offended if a variable called 'code' is clobbered. Anyway, my mother also told me that breaking promises is not a nice thing to do so I try to keep that in mind when I design programming interfaces.