'new' module deprecation in python2.6

David Pratt fairwinds.dp at gmail.com
Sat Nov 29 19:00:34 CET 2008


Hey Christian. Many thanks for explanation. Clears that up :-)

Regards,
David

On Nov 29, 2008, at 1:52 PM, Christian Heimes wrote:

> David Pratt wrote:
>> Hi Mike. Many thanks for your reply and thank you for reference.   
>> I have code that looks like the following so initially looking at  
>> what will need to be done as it doesn't appear new will survive.  
>> So first need to find way of translating this sort of thing using  
>> types. I see there is a ClassType for types in Python 2.6 but it  
>> does not exist in Python 3 so wonder where this is going? Is this  
>> an oversight or maybe just not ready yet.
>
> ClassType is the type of old style classes. Since old style classes  
> were removed the ClassType is also gone.
>
> You can create new style classes with type:
>
> >>> Name = type("Name", (object,), dict(spam="egg"))
> >>> Name
> <class '__main__.Name'>
> >>> Name.spam
> 'egg'
>
> Christian
>
> --
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list