Guido van Rossum | 94c9d90 | 2002-06-16 01:22:13 +0000 | [diff] [blame] | 1 | """Create new objects of various types. Deprecated. |
| 2 | |
| 3 | This module is no longer required except for backward compatibility. |
| 4 | Objects of most types can now be created by calling the type object. |
| 5 | """ |
Christian Heimes | 28104c5 | 2007-11-27 23:16:44 +0000 | [diff] [blame] | 6 | from warnings import warnpy3k as _warnpy3k |
| 7 | _warnpy3k("The 'new' module is not supported in 3.x, use the 'types' module " |
| 8 | "instead.", stacklevel=2) |
Guido van Rossum | 94c9d90 | 2002-06-16 01:22:13 +0000 | [diff] [blame] | 9 | |
| 10 | from types import ClassType as classobj |
| 11 | from types import FunctionType as function |
| 12 | from types import InstanceType as instance |
| 13 | from types import MethodType as instancemethod |
| 14 | from types import ModuleType as module |
| 15 | |
| 16 | # CodeType is not accessible in restricted execution mode |
| 17 | try: |
| 18 | from types import CodeType as code |
| 19 | except ImportError: |
| 20 | pass |