Re: [Python-Dev] removing the new and types modules
Redirecting discussion from python-checkins to python-dev. 'new' has now been deprecated for 3.0, GvR suggested it would be nice to get rid of 'types' as well. Christian Heimes wrote:
Georg Brandl wrote:
I've just looked, and the types you can't get trivially via builtin or type(singleton) are
* module * function * generator * code * method * builtin-function-or-method * frame * traceback * dictproxy * getset- and member-descriptor
Where would one put them?
Python 3.0 has several more types that aren't exposed through types. For example the views like dict_keys, dict_values and dict_items are not in types.
Most of those 'hard-to-get-at' types are tied pretty tightly to the interpreter internals, and would fit in with Guido's suggestion of a 'pyvm' module. Such a module would let us clean up the 'sys' namespace a little bit by moving some of the more arcane hackery to another module (like the recursion limit and the threading check interval). The only ones I would suggest putting elsewhere are the module type (exposing it through the imp module instead), and the new dict_keys/_values/_items types (exposing them through the collections module, as others have suggested). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
Nick Coghlan wrote:
'new' has now been deprecated for 3.0, GvR suggested it would be nice to get rid of 'types' as well.
I've removed the 'new' module from py3k and also removed a lot of types from the 'types' module in py3k. It only contains types that aren't easily available through builtins.
Most of those 'hard-to-get-at' types are tied pretty tightly to the interpreter internals, and would fit in with Guido's suggestion of a 'pyvm' module. Such a module would let us clean up the 'sys' namespace a little bit by moving some of the more arcane hackery to another module (like the recursion limit and the threading check interval).
Can we leave 'pyvm' until the next alpha is out? We are already near the schedule for mid to end of November.
The only ones I would suggest putting elsewhere are the module type (exposing it through the imp module instead), and the new dict_keys/_values/_items types (exposing them through the collections module, as others have suggested).
Several other types are used in the Python core, too. The most remarkable is MethodType (to bind functions to instances) but also FunctionType and CodeType. Christian
participants (2)
-
Christian Heimes
-
Nick Coghlan