Python, my fallible point

The difference between object-oriented and process-oriented

The so-called object-oriented, in fact, is to split a transaction into many functions, each function is an object. Just like designing backgammon, the rule is an object, the chessboard is an object, and Othello is another object.

The so-called process-oriented, in fact, is to split a transaction into several steps, write a function for each step, and call it once. Or backgammon, 1. Start the game, 2. The black piece goes first, 3. Draw the picture, 4. Judge the winner or lose, 5. It is the turn of the white piece, 6. Draw the picture, 7. Judge the winner or lose, 8. Return to steps 2, 9, and output the last result. Implement each of the above steps with separate functions, and the problem is solved.

Python is an object-oriented programming language

The so-called inheritance is that the subclass inherits fields and methods from the parent class.

The so-called overriding means that the method inherited by the subclass from the parent class does not meet the requirements, and the overriding of the method, called overriding, also becomes overloading.

Whether the double underscore is added in front of the method or the front of the property indicates that it is private.

The default __init__ method is not overloaded

The difference between a class and a normal function is that the class must have an extra parameter named self. self represents the instance of the class, self.class represents the class

These two functions are both in the re module and are used for regular expression judgment. The difference is that match only matches the beginning of the string. If it does not match at the beginning, it will return none; while search matches the entire string until a match is reached.

Both post and get can be used to submit data. The difference is that when post submits data, the data information is packaged in the http package body, while get directly saves the data information on the url for submission, with a ? mark, and the following content is the submitted data. Therefore, post is more secure than get, so it is customary to use get as a request for data from the server, and post as a request to submit data to the server.

The four operations of Put, delete, post, and get are equivalent to adding, deleting, and checking in the http protocol.

Atomicity: either do it all or none of it

Consistency: bringing the database from one consistent state to another consistent state

Isolation: one transaction does not interfere with other transactions executing in parallel

Permanent: Once executed successfully, the change is permanent

1. An application has at least one process, and a process has at least one thread.

2. Threads can create and interrupt threads, and share memory between threads in the same process.

3. Processes have independent memory units during execution, while multiple threads share memory.

4. The thread only has some essential resources such as registers, so it needs less resources when switching.

Difference between remove and pop functions

1. Both functions are used to delete an element in a list

2. The remove function is used to delete the first matching element starting from the list; the pop function deletes the last element by default

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324981246&siteId=291194637