Detailed explanation of Python Ethereum development
the loads() function performs the same deserialization as the load() function. Instead of accepting a stream object and reading the serialized data from a file, it accepts the str object containing the serialized data and returns the object directly.
features:
blockchain is an immutable and orderly chain record composed of block records. The main features are as follows:
1: decentralization
e to the use of Distributed Accounting and storage, there is no centralized hardware or management organization, the rights and obligations of any node are equal, and the data blocks in the system are jointly maintained by the nodes with maintenance function in the whole system. Thanks to the decentralization of blockchain, bitcoin also has the characteristics of decentralization
2: openness
the system is open, in addition to the private information of the parties to the transaction is encrypted, the data of the blockchain is open to all, and anyone can query the blockchain data and develop related applications through the open interface, so the information of the whole system is highly transparent
3: autonomy
blockchain adopts consensus based specifications and Protocols (such as a set of open and transparent algorithms) to enable all nodes in the whole system to exchange data freely and safely in a de trusted environment, so that the trust in "people" is changed into the trust in machines, and any human intervention does not work
4: information cannot be tampered with
once the information is verified and added to the blockchain, it will be stored permanently. Unless more than 51% of the nodes in the system can be controlled at the same time, the modification of the database on a single node is invalid, so the data stability and reliability of the blockchain are extremely high
5: anonymity
since the exchange between nodes follows a fixed algorithm, their data interaction does not need to be trusted (the program rules in the blockchain will judge whether the activity is effective by themselves), so the counterparties do not need to make the other party trust themselves by disclosing their identities, which is very helpful for credit accumulation
compared with the traditional distributed database, there are two main differences:
1: the traditional distributed database supports adding, deleting, checking and modifying, while the blockchain only supports searching and inserting, and blocks cannot be deleted or modified
2: the traditional distributed database is generally a master-slave structure: master and slaves structure. In order to ensure high availability, it is realized by standby master, while the blockchain is a decentralized database. There is no master-slave structure
blockchain and bitcoin:
when it comes to blockchain, most people talk about bitcoin. However, blockchain is not equal to bitcoin. It is now the era of blockchain 3.0, and bitcoin is only the proct of blockchain 1.0
the evolution mode of blockchain is:
& ᦇ 9642; Blockchain 1.0 digital currency; Blockchain 2.0 digital assets and smart contracts; Blockchain 3.0 - Implementation of distributed applications in various instries
classification of blockchain:
public blockchains
public blockchain means that any indivial or group in the world can send transactions, and transactions can be effectively confirmed by the blockchain, and anyone can participate in its consensus process. Public blockchain is the earliest and the most widely used blockchain. The virtual digital currencies of bitcoin series are all based on public blockchain. There is only one blockchain corresponding to this currency in the world
consortium blockchains
instry blockchains: multiple preselected nodes are designated as bookkeepers within a certain group, and the generation of each block is jointly determined by all preselected nodes (preselected nodes participate in the consensus process). Other access nodes can participate in transactions, but not the bookkeeping process (essentially, trusteeship bookkeeping), It just becomes distributed accounting, the number of preselected nodes, and how to determine the bookkeeper of each block to become the main risk point of the blockchain). Anyone else can conct limited query through the open API of the blockchain
private blockchain: it only uses the general ledger technology of blockchain for bookkeeping. It can be a company or an indivial, enjoying the write permission of the blockchain. This blockchain is not very different from other distributed storage schemes Dec2015) conservative giants (traditional finance) want to experiment with private blockchain, while the application of public chain, such as bitcoin, has been instrialized, and the application procts of private chain are still groping.
We need to learn Linux, XHTML, CSS, JavaScript, database (relational, NoSQL, etc.) and requirement analysis
stage 1: Python development foundation
Python development foundation of Python full stack development and artificial intelligence. The learning content includes: Python basic syntax, data type, character encoding, file operation, function, decorator, iterator, built-in method, common moles, etc
stage 2: Python advanced programming and database development
Python full stack development and artificial intelligence: Python advanced programming and database development knowledge learning content includes: object-oriented development, socket network programming, thread, process, queue, IO multi-channel model, MySQL database development, etc
stage 3: front end development
the front-end development knowledge of Python full stack development and artificial intelligence includes: HTML, CSS, JavaScript development, jQuery & bootstrap development, front-end framework Vue development, etc
stage 4: Web Framework Development
learning content of Python full stack development and artificial intelligence web framework development includes: Django framework foundation, Django framework advanced, BBS + blog actual combat project development, cache and queue middleware, flash framework learning, tornado framework learning, restful API, etc
stage 5: crawler development
Python full stack development and AI crawler development learning content includes: crawler development practice
stage 6: full stack project practice
the whole stack project practice learning content of Python full stack development and artificial intelligence includes: enterprise application tool learning, CRM customer relationship management system development, Lufei online ecation platform development, etc
stage 7: data analysis
data analysis of Python full stack development and artificial intelligence learning content includes: financial quantitative analysis
stage 8: AI
Python full stack development and Ai Ai learning content includes: machine learning, graphics recognition, UAV development, unmanned driving, etc
stage 9: automatic operation and maintenance & Development
Python full stack development and automatic operation and maintenance & development of artificial intelligence. The learning contents include: CMDB asset management system development, it audit + host management system development, distributed host monitoring system development, etc
stage 10: high concurrency language go development
Python full stack development and high concurrency language go development of artificial intelligence learning content includes: go language foundation, data type and file IO operation, function and object-oriented, concurrent programming, etc.
I had the privilege of working with Doug Hellmann for several months. He is a very senior software development engineer in Dreamhost and a contributor to the openstack project. He launched a website about python, python mole of the week (), and published a famous pyhton book, the python standard library by example (). At the same time, he is also a core developer of Python. I have consulted Doug about the standard library and its design and application
when you develop a python application from scratch, how do you take the first step? How is it different from developing an existing application
from an abstract point of view, the steps are almost the same, but the details are different. Compared with the development of new projects and existing projects, my personal approach to application and library development is more different
when I want to modify the existing code, especially when the code is created by others, I need to study how the code works and what code I need to improve at first. I may add logs or output statements, or use PDB to run the application with test data, so that I can understand how it works. I often make changes and test them, and add possible automated tests before each commit
when creating a new app, I will take the same step-by-step approach. I first create some code, and then run them manually. After this function can be basically called, I write test cases to ensure that I have covered all boundary conditions. Creating test cases also makes code refactoring easier
this is the case with smiley(). Before developing a formal application, I try to write some temporary scripts using Python's trace API. For smiley, my initial idea included a dashboard to collect data from another running application, and another part to receive and save data sent over the network. In the process of adding several different reporting functions, I realized that the process of replaying the collected data is basically the same as that of collecting data at the beginning. So I refactored some classes and created base classes for data collection, database access, and report generator. By making these classes follow the same API, I can easily create a version of the data collection application, which can write data directly to the database without sending data over the network
when designing an application, I will consider how the user interface works, but for libraries, I will focus on how developers use their APIs. By writing test code first instead of library code, it's a little easier to think about how to develop applications through this new library. I usually create a series of sample programs as tests, and then build the library according to the way it works
I also found that writing documentation before writing any library code allows me to fully consider the use of functions and processes without having to submit any implementation details. It also allows me to document my design choices so that readers can understand not only how to use the library, but also what I expect when I create it. That's what I'm doing with stevedore
I know that I want stevedore to be able to provide a set of classes for managing plug-ins for applications. During the design phase, I spent some time thinking about the common patterns of using plug-ins that I've seen, and wrote a few pages of rough documentation describing how these classes should be used. I realized that if I put the most complex parameter in the constructor of a class, the method map () is almost interchangeable. These design notes are written directly into the introction of the official document of stevedore to explain the different patterns and guidelines for using plug-ins in applications
what is the process of adding a mole to the python standard library
the complete process and specification can be implemented in Python developer & # 39; Found in s guide()
before a mole is added to Python standard library, it needs to be proved to be stable and widely used. The functions that moles need to provide are either difficult to implement correctly or so useful that many developers have created their own variants. The API should be very clear and its implementation should not rely on any libraries other than standard libraries
the first step in proposing a new mole is to get an informal idea of how interested you are in this via the python ideas mailing list in the community. If the response is positive, the next step is to create a python enhancement proposal (PEP), which includes the motivation for adding this mole and some implementation details of how to transition
because the management and discovery of packages are very stable, especially PIP and python package index (pypi), it may be more practical to maintain a new library outside the standard library. Indivial releases make it possible to update new features and bugfix more frequently, which is particularly important for libraries dealing with new technologies or APIs
which three moles in the standard library do you want people to know more about and start using
recently, I have done a lot of work on dynamic loading extensions in applications. I use the ABC mole to define APIs for extensions that act as abstract base classes to help extension authors understand which methods of the API are required and which are optional. Abstract base classes have been built into some other languages, but I find that many Python programmers don't know that Python also has them
bisection search algorithm in bisect mole is a good example, which is widely used but not easy to implement correctly, so it is very suitable for standard library. I especially like that it can search sparse lists, and the search value may not be in them
many useful data structures in the collections mole are not widely used. I like to use namedtuple to create small data structures like classes to hold data, but I don't need any association logic. If you need to add logic later, you can easily convert namedtupe to a normal class, because namedtupe supports accessing properties by name. Another interesting data structure is chainmap, which can generate a good hierarchical namespace. Chainmap can be used to create context for template parsing or to manage configuration from different sources through clear process definition
many projects (including openstack) or external libraries will encapsulate their own abstraction on top of the standard library. For example, I would like to know more about the processing of date / time. Do you have any suggestions for that? Should programmers stick with standard libraries, or should they write their own functions, switch to other external libraries, or start patching Python
all of these are OK. I tend to avoid building wheels over and over again, so I strongly advocate contributing patches and improving projects that can be used as dependencies. However, sometimes it makes sense to create additional abstractions and maintain the code separately, either within the application or as a new library
in the example you mentioned, the timeutils mole in openstack is a very thin encapsulation of Python's datetime mole. Most of the functions are short and simple, but by encapsulating these most common operations into a mole, we can ensure that they are handled in a consistent way in the openstack project. Because many functions are application related, in a sense, they strengthen some decision-making problems, such as the format of string timestamp or what "now" means. They are not suitable to be used as patches of Python standard library or as a general library and adopted by other projects
on the contrary, I am currently working on converting openstack's API service project from the WSGI framework used in the early creation to a third-party Web development framework. There are many options for developing WSGI applications in Python, and when we may need to enhance one of them so that it can fully meet the needs of the openstack API server, it seems preferable to maintain a "private" framework with these reusable modification contributions
when importing and using a large number of moles from standard libraries or other places, do you have any specific suggestions on what to do
I don't have any rigid restrictions, but if I have too many imports, I will reconsider the design of this mole and consider splitting it into a package. Compared with the upper mole or application mole, this split of the lower mole may occur faster, because for the upper mole, I expect to organize more fragments together
about Python 3, what moles are worth mentioning and are of interest to developers
the number of third-party libraries supporting Python 3 has reached a decisive moment. Developing new libraries or applications for Python 3 has never been easier, and thanks to the compatibility features added in 3.3, it's easy to maintain support for Python 2.7 at the same time. Major Linux distributions are working to install Python 3 by default. Anyone who wants to create a new project in Python should seriously consider Python 3 support, unless there are dependencies that have not yet been ported. Currently, libraries that can't run on Python 3 are considered "no longer maintained."
many developers write all the code into the application, but in some cases it may be necessary to encapsulate the code into a library. What's the best way to do this about design, planning, migration, etc
an application is a collection of "glue code" used to organize libraries together for specific purposes. These functions can be implemented as a library at the beginning of design, and then the code of the library can be well organized into logical units when building the application, which will make the test easier. It also means that the functions of the application can be accessed through the library and can be recombined to build other applications. Failure to adopt this method means that the function of the application and the user interface are too tightly bound, which makes it difficult to modify and reuse
What are the suggestions for people planning to start building their own Python libraries
I usually suggest that libraries and APIs be designed from top to bottom and that the single responsibility principle (SRP) be applied to each layer. Consider how callers use the library and create an API to support these functions. Consider what values can be used by methods in an instance, and what values each method passes in each time. Finally, consider the implementation and whether the underlying code should be organized differently from the public API
Sqlalchemy is a great example of applying these principles. The declarative ORM, data mapping, and expression generation layers are separate. Developers can decide for themselves the right level of abstraction for API access and use the library based on their needs rather than constraints imposed by the design of the library
What are the most common programming errors when you randomly look at Python programmers' code
one big difference between Python idioms and other languages is loops and iterations. For example, I
Python still has a lot of learning content. We divide the learning process into four stages, and learn the corresponding content in each stage, The specific learning order is as follows:
< H2 > Python learning order:① Python software development foundation
< UL >master the composition and working principle of the computer
be able to use common Linux tools
skillfully use the basic command of docker
to establish a python development environment, And use print output
use Python to complete all kinds of string operations
use Python re mole for program design
use Python to create files, access and delete files
Master import statements, from... Import statements, from... Import * statements, method references Package in Python
(2) Python software development advanced
< UL >can use Python object-oriented method to develop software
can establish database, table, and basic database operation
master the use of non related coefficient database mongodb, Master redis development
be able to independently complete TCP / UDP server client software development, be able to realize FTP and HTTP servers, develop mail software
be able to develop multi process and multi thread software
③ Python full stack Web Engineer
< UL >be able to independently complete back-end software development, Deeply understand the essence of Python back-end development
be able to independently complete front-end software development and combine with back-end, Proficient in using Python for web development skills
(4) Python multi domain development
< UL >be able to use Python to write crawler software
be able to use Python library for data analysis
job data crawling analysis
be able to use Python open source artificial intelligence box If you plan to study offline, it is recommended to investigate and compare Zhongbo Software Institute, Nanjing Ke workshop, Zhongbo Software Institute, Nanjing Ke workshop, Zhongbo Software Institute, Nanjing Ke workshop, Nanjing Ke workshop, Zhongbo Software Institute, Nanjing Ke workshop, Nanjing Ke workshop, Nanjing Ke workshop Nanjing Beida Qingniao and other schools offering Python majors, remember to ask me for a full set of Python video courses. I wish you success in your study! Hope to adopt strong>

live photo of the python classroom of Qingniao Zhongbo Software College of Peking University
