美文网首页
Python Class wz/wzout initializa

Python Class wz/wzout initializa

作者: cutelittlePanda | 来源:发表于2017-06-05 20:17 被阅读0次

    Simple code:

    Notice of writting class:

    1). Begin with 'class' keyword;

    2). ALLWAYS Capitalize the First Letter of class Name; 

    3). Create class instance just like calling a function.

    4). Self used to attach variables and functions to a class; if the 'self' missing, then 'TypeError' occurs:

                TypeError: functionName() takes no arguments....

    5). in Python 3.x.x , to use parenthesis '()' after 'print'; EX:

                                      print("something balalalalallallallalla")


    Initialization:

    1). Also called Constructor;

    2). Function RUN when class instance created;

    Example class code with 'SELF' initialization and function calls shown as below:

    'Good' and 'Bad' when initialization with 'SELF' in class To call a function within the same class Class code with 'SELF' - Part 1 Class code with 'SELF' - Part 2 Class code without 'SELF' - Final

    相关文章

      网友评论

          本文标题:Python Class wz/wzout initializa

          本文链接:https://www.haomeiwen.com/subject/epobfxtx.html