Lpthw stupid way to learn Python 40 Chapter Class

Source: Internet
Author: User

Today read the 40th chapter of LPTHW after the enlightened, the original has been dull, do not understand the definition and use of the class, there is not quite understand the definition of self.

class MyStuff (object): def __init__  "and nowa thousand years between"def  Apple:  print
    "I AM classy apples! "  
Say the class and the Mini module is similar, then for the class, there must be an import-like concept. The concept name is "instance (instance)". This is just a acting knowledgeable, it means "create". When you "instantiate" a class, you get an object. The way to instantiate is to call a class as if it were called a function: thing = MyStuff () thing.apple () print Thing.tangerine

__init__'Frank'='Frank ' You know exactly what this refers to is the attribute Self.cheese of the instance.

Don't quite understand the definition of super in class inheritance.

Read the comments on the Internet more and more confused.

Lpthw stupid way to learn Python 40 Chapter Class

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.