2015年12月20日日曜日

Python Programming/Classes -

New Style Classes>

New style classes were introduced in python 2.2. A new-style class is a class that has a built-in as its base, most commonly object. At a low level, a major difference between old and new classes is their type. Old class instances were all of type instance. New style class instances will return the same thing as x.__class__ for their type. This puts user defined classes on a level playing field with built-ins. Old/Classic classes are slated to disappear in Python 3. With this in mind all development should use new style classes. New Style classes also add constructs like properties and static methods familiar to Java programmers.


python101 by Michael Driscoll said, class className(object): is python 2.x style, class className: is python 3.x style.


other web pages dont say about (object) style.

0 件のコメント:

コメントを投稿