Python Learning

  1. Octal expression: 0oxxx like 0o4578
    Or use a built-in function oct() to transfer a int into a octal
    str.
  2. Hex expression: 0x456
  3. For a dictionary, if use its method copy(), then it jsut a swallow copy, with the basic data types copied, and the others referenced.
    If wanna use a full copy, then we have to use from copy import deepcopy

Note

  1. Why python can manipulate pakages, models, functions, classes?

    Because is an OOP (Object-Orient Programming) language, and everything is object in Python.
    For example, if a pakage is imported, then a memory address is created and used by this pakage.
    Next, I can use this pakage to do many things.

    Sometimes, there is a comfusion about the relation between class, object, and instantiation. Let me explain it now:
    For sure, to use these nouns, we need to figure out the situations and scopes. If we are talking on the macro, then a class is object,
    and many things which can be used are objects. When a class is used, then we call it is instanced, then we can say that the name of its
    instance, is an object.

    The real issue is that just don't entangle it, we need to know how it works, which is the key point.

  2. Why does PyCharm have both builtins and builtin modules in his own path?

    I can see that if I write codes in PyCharm, then I use its modules. I think that it just is for some reasons
    and of course, I need not focus on it. By the way, there are some difinitions emitted in PyCharm's modules,
    like True and False. But they still can be used.

    If I use the command line mode, then the default python builtins and builtin modules are used.

    By the way, after some checks for builtins, I found that all of functions and classes inherites object.
    And they have some different attributes.

I have say that builtins and builtin modules can't be founded in the root directory of Python
Now I have known how to check and use those in builtins, and that is enough

原文地址:https://www.cnblogs.com/brad1994/p/6514811.html