Guangzhou Automobile Honda Accord Car Purchase Guide Advanced Texture

The richness of the configuration is closely linked to the cost performance of a car, and many people have mentioned it. Now let’s follow Xiaobian to see what it has done.

Let’s take a look at the appearance of the Accord first. The front shape of the Accord has taken a fashionable and simple route, and it looks very individual with a multi-spoke middle net. Coupled with headlights, the shape is quite simple. The car is equipped with LED daytime running lights, automatic opening and closing, adaptive far and near light, delayed closing and so on. Coming to the side of the car, the body size of the car is 4980MM*1862MM*1449MM. The car adopts fashionable lines, and the side circumference gives people a very delicate feeling. With large-sized thick-walled tires, the shape is quite individual. In terms of the rear end, the overall shape of the Accord’s rear end echoes the front face, and the taillights present a tough design style, coupled with the hidden exhaust pipe, creating a good gas field.

Sitting in the car, the interior looks very simple and generous, which is very suitable for the tastes of young consumers. The steering wheel design of this car is very cold, and it is equipped with the functions of manual steering wheel up and down+front and rear adjustment, which gives people an impulse to control it. From the central control point of view, the design of the center console is reasonable, which makes the interior design quite layered and conforms to the mainstream aesthetics. The interior feels good, let’s take a look at the dashboard and seats. The car is equipped with a soft dashboard, and the sports atmosphere is in place. The car uses leather seats, which are wrapped in place and are very comfortable to ride.

Accord is matched with CVT gearbox, with a maximum power of 141KW and a maximum torque of 260N.m, and its power performance is good.

The space size of the Accord trunk is in line with its household positioning, and the storage space for family travel can be met, with excellent space flexibility. In addition, the car is equipped with fatigue warning, anti-lock braking (ABS), LED daytime running lights, brake assist (EBA/BAS, etc.), braking force distribution (EBD) main driving airbag, co-pilot airbag, knee airbag, side airbag curtain, front side airbag and other safety configurations.

After reading the above description, Xiaobian will make a summary. The car introduced today is not only eye-catching in space, but also has reached the mainstream level in various configurations, and there is nothing to be picky about driving experience and space experience.

Strive for the spring tide, Guiyang Yunyan sprints to "open the door steadily" in the first quarter.

  Xinhuanet Guiyang, April 2 (Lu Zhijia) This year is a crucial year for Guizhou to implement the action of "strengthening the province". Doing a good job in economic work in the first quarter is of great significance to promoting high-quality economic and social development and achieving the goals and tasks for the whole year. As the main battlefield for Guizhou to implement the strategic action of "strengthening the province", Yunyan District in the central city of Guiyang has been pressing ahead since the beginning of the year, making every effort to grasp projects, attract investment and promote consumption, and strive to "open the door steadily" in the first quarter.

Micro-core technology located in Yunyan old cigarette factory. Xinhua Net Fa (photo by Guo Ran)

  Speed up the construction around the key project "stepping on the spring"

  Recently, in the key project site of the first phase of education infrastructure construction in Sanma area of Yunyan District (the primary school attached to the National People’s Congress), most of the main buildings of this project have been capped, and the teaching building is being installed, and the workers are busy in an orderly and nervous manner at the scene. Qiu Shikai, the person in charge of the project site, said that as one of the key projects in Yunyan District, the project attached to the National People’s Congress has a total investment of 838 million yuan. After completion, it will have 48 classes and 1,920 degrees, focusing on solving the problem of schooling for the surrounding children. "We are increasing personnel investment, strengthening financial guarantee, seizing time, striving for speed and ensuring safety, and ensuring that the project is completed on time, with good quality and quantity."

Aerial photography of the construction site of the small project attached to the People’s Congress in Yunyan District. Xinhua Net Fa (LongbuildRui she)

  It is reported that Sanma Industrial Concentrated Development Zone is one of the industrial concentrated development zones in Yunyan District with the principle of "concentration+decentralization", and it is an important platform for carrying high-quality projects and cultivating industrial clusters.

  Park construction, the foundation first. At the beginning of this year, Bid A of Mawang Road in Sanma District was officially opened to traffic, and successfully connected with Bid B and Bid C, which realized the east-west connection of Sanqiao South Road, Gaicha Avenue, Shubo Avenue and Baihua Avenue, effectively relieved the traffic pressure of Beijing West Road and Baihua Avenue, and also marked the completion of 22 broken road projects in the city.

  In terms of real estate industry, key projects such as Enxiang Vanke Guanshan Jiadi, Hellenborg Tianyuefu, Lushan Urban Complex and Wuyue Plaza in Yunyan District are also being promoted in an orderly manner.

  The new city is jointing and the old city is rejuvenating, creating a livable and suitable environment for economic development. Yunyan District is also promoting the transformation of old residential areas. Entering the renovation project of the old residential area in Minsheng Road area, many parking spaces have been added in the courtyard, the dark corridor has also been painted, and workers are replacing the manhole cover. "Now the old appearance of the courtyard, the rectification of sewage discharge, lighting monitoring equipment and other projects have been completed. Next, fitness equipment and cultural corridors will be set up in the community." Wang Lei, the project leader, said. At present, the renovation project has entered the final stage and is expected to be completed before the end of June this year.

  To improve the happiness of community residents, on the one hand, we should solve their "just need" of life, and also find gyms, coffee shops and theaters nearby. To this end, Yunyan District is drawing a "15-minute life circle" for citizens through project implementation.

The construction of Shanhai City Sports Park in Yunyan District has come to an end. Xinhua Net Fa (photo by Lu Xiaofang)

  The construction of Shanhai City Sports Park, located in Baoshan North Road, Yunyan District, is drawing to a close. A comprehensive project focusing on sports services and integrating health, culture, leisure and education will soon be "upgraded" in densely populated areas in Yunyan District. "At present, 9 large stadiums and 1 kindergarten, including basketball stadium, badminton stadium, boxing stadium, rhythmic gymnastics hall and art stadium, have been completed, covering 11 projects, and all other projects will be completed by the end of April." Cai Qingbin, chairman of Guizhou Shanhai Education Group, said that all the project coaches in the venue are retired athletes from provincial teams and national teams, and there are international referees to guide the teaching.

  In addition, the construction of Xinhua Cultural and Creative Block in Yunyan District, which started at the end of March 2022, is also in full swing. This block, formerly known as Guizhou Xinhua Printing Factory, will be transformed into an innovative cultural tourism consumption block integrating museums, exhibition halls, bookstores, comprehensive business districts and cultural and creative markets, and it is expected to be put into use in October.

  Focus on strong chain, supplement chain, quantity and quality, and strengthen investment promotion

  In the first quarter of this year, Yunyan District focused on "specialization and innovation" and aimed at "strengthening the chain", and actively set up investment promotion teams to go to Beijing, Shenzhen, Guangzhou, Chengdu and other places to set off a powerful offensive of industrial investment promotion.

  On February 14th, Yunyan District went to Shenzhen with a series of "gift packages" for enterprises, such as ten preferential policies for attracting investment and ten preferential policies for safety and business, and opened a special industry investment promotion meeting in Guangdong-Hong Kong-Macao Greater Bay Area, recommending superior resources and industrial clusters to 88 enterprises, and making field visits to many enterprises.

  Guangdong-Hong Kong-Macao Greater Bay Area is rich in innovative resources, active in scientific research and development, and high-quality enterprises gather. At present, industrial capital has a strong driving force for scale transfer and expansion to the mainland. Undertaking industrial transfer in Greater Bay Area is of great practical significance for Yunyan District to achieve high-quality development.

Yunyan District Industry Investment Promotion Conference in 2023-Guangdong-Hong Kong-Macao Greater Bay Area Special Session was held in Shenzhen on February 14th. Xinhua Net Fa (photo by Guo Ran)

  At the promotion meeting, responsible persons of enterprises such as Shenzhen Beidou Communication Technology Co., Ltd. and China Electronic Information Industry Group all expressed their willingness to go to Yunyan for on-the-spot investigation. Wei Tiangui, chairman of Shenzhen Tiansheng IOT Technology Co., Ltd., said that the company now plans to expand its production scale, hoping to realize research and development in Shenzhen and move production to Guiyang …

  Since the start of a new round of cooperation between the east and the west, Yunyan District has visited Guangdong for investment many times and introduced a number of enterprises and projects with strong chain, supplementary chain and extended chain. Up to now, 62 Guangdong-Hong Kong-Macao Greater Bay Area projects have been introduced into Yunyan District, mainly in the fields of electronic information manufacturing, big data integration and modern commerce, with a total investment of nearly 60 billion yuan. Nine upstream and downstream industrial projects, such as Shenzhen Xinxian AI artificial intelligence system research and development and intelligent manufacturing project, Xinhuoyuechuang intelligent manufacturing and engineering technology center project and Shenzhen Angdai photoelectric electronic display project, were introduced.

  On March 4th, at the work promotion meeting of the 2023 Industrial Investment Promotion Breakthrough Year held in Yunyan District, the "spring offensive" of investment promotion in Yunyan District reached a climax, and 15 projects were signed centrally, with a total investment of 20.6 billion yuan, covering key areas such as commerce and trade, cultural tourism, urban renewal, big data, intelligent manufacturing, productive services, big health and rural revitalization.

Centralized signing ceremony of industrial investment projects in Yunyan District in the first quarter of 2023. Xinhua Net Fa (photo by Guo Ran)

  Wang Qiyun, secretary of Yunyan District Party Committee, said at the meeting that the whole region should change the concept of investment promotion, innovate the way of investment promotion, focus on "specialization and novelty", fully promote investment promotion in industrial chain, continue to deepen the reform of "streamline administration, delegate power, strengthen regulation and improve services" and "running once at most", enhance the service capacity of "one network to run", and comprehensively strengthen the construction of government, business and policy environment.

  In the first quarter of this year, Yunyan District introduced three central enterprises and state-owned enterprises, and completed 18 contracted projects at the district level with a contracted investment of 20.8 billion yuan. Yunyan District, which is in the period of "Strong Province Meeting", the initial stage of "Old Town Core" construction and the period of industrial development transformation and upgrading, will implement the "Six Major Investment Promotion Actions" with the attitude of attracting all employees this year to promote high-quality development with high-quality investment promotion.

  Focus on quality upgrading, tap the potential and promote consumption

  During the Spring Festival, Yunyan District took food as the medium, and held the "Fresh Buy Festival" and the "Fresh Food Festival" in Zhengxin Street, the favorite base of old Guiyang, and Taiping Road, the newly-built trend block, respectively, and adopted a series of measures such as "consumption reduction" and "shopping lottery" to benefit the people and ignite the holiday economy in the thick flavor of the year.

Citizens play in the Food Festival of Taiping Road in Yunyan District. Xinhua Net Fa (photo by Guo Ran)

  Recently, the "script killing" business of "Qiqi Reasoning Society" in Baoshan North Road, Yunyan District has continued to be hot, with an average of about 4 games per day, and the tables are often full and even need to be turned over on weekends …

  Yitian Holiday Plaza, located in Dayingpo, Yunyan District, is becoming more and more popular. In the square outside the shopping mall, the trunk market attracts a large number of citizens to stop spending. In the shopping mall, there are long queues at the gates of some popular catering shops. "Now it has basically returned to the peak state, and it is basically full on Friday and Saturday nights. Consumers are making online appointments to come to the store for dinner." The person in charge of a restaurant in Yitian Holiday Plaza said.

Citizens relax and spend money in a shopping mall in Yunyan District. Xinhuanet Lu Zhijia photo

  Since the Spring Festival, the pace of consumer market recovery in Yunyan District has been accelerating, and various scenic spots and business districts are full of popularity. At the same time, a series of policies and measures to promote consumption have been introduced one after another, and consumer confidence has been further boosted.

  It is reported that Yunyan District will also speed up the renovation and upgrading of night economic blocks such as Taiping Road and Minsheng Road, guide the upgrading of eight commercial complexes in the fountain-Grand Cross business district, and build Renmin Avenue into the central business district of the city. In the future, the Ark area will be built into a demonstration zone for the integration of cultural and business travel.

  With the gradual implementation of a batch of business sports tourism projects, Yunyan District will reshape the core business district, upgrade the community business district, and rely on the constantly enriched consumer carriers and the constantly improved consumption quality to promote the sustained release of consumption potential.

It is inevitable that the real estate market will pick up in the first half of the year, such as "land king"


Deputy Director of the National Development and Reform Commission Zhu Zhixin China Net Rui Wang photo


> > > State Council Office’s Press Conference on the Current Macroeconomic Situation [Record] < <


   The State Council Press Office will hold a press conference on the afternoon of August 7, 2009, inviting Zhu Zhixin, vice director of the National Development and Reform Commission, Ding Xuedong, vice minister of finance, and Suning, vice governor of the People’s Bank of China, to introduce the current macroeconomic situation and take questions from reporters.


   The Beijing News reporter asked at the press conference that the real economy is still in a difficult stage, but the prosperity of real estate has worried many people. For example, a new "land king" was shot on Guangqu Road in Beijing a while ago, including the developers themselves. I feel crazy and hard to understand. What do you think of the current situation of the real estate market? Is it necessary to make policy adjustments?


   Zhu Zhixin, deputy director of the National Development and Reform Commission, replied that the real estate market can be judged in one sentence in the first half of the year: the real estate market continued to pick up in the first half of the year. I use three figures to illustrate: first, the investment in real estate development was 1,450.5 billion yuan, an increase of 9.9% over the same period last year; Second, the sales area of commercial housing was 341.09 million square meters, an increase of 31.7%; Third, the housing sales prices in 70 large and medium-sized cities in June rose by 0.2% compared with the same period last year. Overall, the real estate market is in the process of recovery.


  Zhu Zhixin said that when it comes to the continued recovery of the real estate market, the journalists present here think about it. A very important change may have taken place in the real estate market at the end of last year and the beginning of this year. In the process of warming up, there will also be some hot issues in some aspects, which is inevitable. I think we should promote the healthy development of the real estate market.


Related news:


Deputy Director of the National Development and Reform Commission: Statistical data accurately determines that macro policies are in line with reality


Development and Reform Commission: The next step is to adhere to a proactive fiscal policy and a loose monetary policy.


Development and Reform Commission: The external environment for economic development is still grim, and external demand will continue to be sluggish.


Ministry of Finance: The next step will be to pay attention to the capital market situation and stabilize the development of the stock market.


Central Bank: "Fine-tuning" is not a fine-tuning of monetary policy.


The deputy governor of the central bank said that the monetary policy was successful and there was no inflation at present.


Development and Reform Commission explains in detail three reasons for macro-policies in the second half of the year.


National Development and Reform Commission: Three "100%" to Ensure the Central Government’s Investment in Place


The central government has invested 380 billion yuan to build 250,000 low-rent housing units.


Deputy Director of the National Development and Reform Commission: Statistical data accurately determines that macro policies are in line with reality

Editor: Zhang Renhe

Top 20 games of M Station in 2023: Tears of the Kingdom, Diablo 4, etc.

Station M announced the top 20 games scored in the first half of 2023, excluding the game compilations released on other platforms in recent years and the newly released game transplants. Let’s take a look at which one scored the highest for multi-platform games.

20. "Disaster Day"-PC platform M station score: 83 points.

19. Miracle Age 4》-PC platform M station score: 83 points.

18. The Underground Labyrinth of Galeria: The Moon Association-NS Platform M Station Rating: 83 points.

17. Tape Monster-PC platform M station score: 84 points.

16. The legacy of Hogwarts-Station M of PS5 platform: 84 points.

15. sonic the hedgehog Murder-PC platform M station score: 84 points.

14. "Traveler 2"-NS platform M station score: 84 points.

13. The score of "Infinite Heart"-NS platform M station: 85 points.

12.《Humanity》-PS5 platform m station score: 85 points.

11. The Seven Incredibles of Paranomasight Institute-Station M of NS Platform: 85 points.

10. Star Wars Jedi: Survivor-M Station of PS5 Platform Rating: 85 points.

9. Diablo IV-PC platform M station score: 87 points.

8. Evaluation of Hi-Fi Rush-XSX platform M station: 87 points.

7. "Final Fantasy: Rhythm Theater"-NS platform M station score: 87 points.

6. Final Fantasy 16-Station M of PS5 platform: 88 points.

5. Dead Space: Remastered Edition-Station M of PS5 platform: 89 points.

4. "Street Fighter 6"-PS5 platform M station score: 92 points.

3. Resident Evil 4: Remastered Edition-Station M of PS5 platform score: 93 points.

2. "Galaxy Warrior Prime Replica Edition"-NS platform M station score: 94 points.

1. "the legend of zelda: Tears of the Kingdom"-NS platform M station score: 96 points.

After being swept out of the house by Manchester United, the four big stars are getting better and better.

Di Maria was born in Rosario, Argentina, on February 14th, 1988. She is a right winger, an attacking midfielder and a left winger. She is an important helper of Lionel Messi in Argentina’s national team and a member of the 2022 FIFA World Cup Qatar 2022 champion.

In August 2014, Di Maria moved to Manchester United, the Premier League giant, but she was not sharp at all during the Real Madrid period. To be precise, she was not acclimatized. She contributed 4 goals and 12 assists in 33 games in various competitions. Because of injuries, her state declined seriously and she was swept out of the house by Manchester United. In August 2015, he joined the French overlord Paris, and in his first season in Paris, he made 47 appearances in various competitions, contributing 15 goals and 25 assists.

Di Maria didn’t win any championship during Manchester United. In the first season after leaving Manchester United, he won the triple crown including Ligue 1, French Cup and French League Cup with Paris.

Lingard was born in Cheshire, England in 1992. He was a former England international midfielder. In July, 2012, he was promoted to the first team of Manchester United, and then he experienced ups and downs in Manchester United. He was once loaned to four teams in leicester city, Birmingham, Brighton and Derbyshire. Returning to Manchester United in May 2015, he played well in the early stage, but after December 2018, he did not score in 34 consecutive Premier League games. In 2019, he scored 0 goals and 0 assists. Lingard, who was extremely depressed, was swept out of the house and joined the Premier League team West Ham United in January 2021.

In January, 2021, Lingard scored twice in his first show when he joined West Ham. Before that, he scored 1 goal in 35 Premier League games for Manchester United. On behalf of West Ham, he scored 8 goals in the first 9 Premier League games, tying the record of scoring the most goals in the Premier League in a single season. In 16 games at West Ham, he contributed 9 goals and 5 assists, which made West Ham sixth in the Premier League and qualified for next season’s European War.

Depe is a Dutch striker. He was born in the Netherlands in 1994. He debuted in Eindhoven, a Dutch giant, in 2006, and won a Dutch champion and a Dutch golden boot with the team. He joined Manchester United in June 2015. In the 2016-17 season of Manchester United’s last season, he came off the bench for 8 times in various competitions, totaling 134 minutes. The Premier League played for 20 minutes without scoring or assisting.

In January 2017, he was swept out by Manchester United and joined the French team Lyon. Depe, who joined halfway, played 26 times on behalf of Lyon in that season, scored 5 goals and had 8 assists; Help Lyon get the fourth place in Ligue 1. In the following season, he played 51 times on behalf of Lyon, contributed 22 goals and 17 assists, helped Lyon win the third place in Ligue 1, and also qualified for the Champions League next season.

Lu Kaku made his debut in the Belgian giants Ande Laichter, and in 2009-10, he helped the Belgian giants win the league championship and crowned himself as the Golden Boot. In 2017, he moved to Manchester United, the Premier League giant. In the last season of the Red Devils, he made 45 appearances in various competitions and contributed 15 goals. However, he was criticized for his poor timing at critical moments. That season, Manchester United only ranked sixth in the Premier League, and Lu Kaku was finally swept out by Manchester United.

On August 8, 2019, Lu Kaku joined Serie A team Inter Milan. In his first season, he scored 34 goals and 6 assists in various competitions, which tied the record that Ronaldo scored the most goals in his first season on behalf of Inter Milan, and it was also the record that he scored the most goals in a single season in his personal career. The Europa League helped the team win the runner-up, and Serie A won the runner-up only by one point.

Or become the "touchstone" of the women’s volleyball team in the World Championships, and four people are worth their money, and these three people are afraid of leaving the team completely.

As the first world competition in the Paris Olympic Games cycle, China women’s volleyball team finished sixth, and once again missed the championship. Fortunately, our ultimate goal is not this year’s World Championships, but the Olympic Games two years later. Therefore, this World Championships can be regarded as an opportunity to train and test the team, discover and cultivate some players through competitions, and lay a solid foundation for the women’s volleyball team to return to the peak in the future! Through this World Women’s Volleyball Championship, four players have played their own value, and they can also lock in a place to stay in the women’s volleyball lineup, while three players may not be able to re-enter the women’s volleyball national team in the future through this World Championship.

First of all, let’s take a look at the four outstanding players. Li Yingying, as the core of the team, will not be mentioned. They are Wang Yun, Diao Linyu, Wang Mengjie and Yang Hanyu! Although Diao Linyu is a veteran in this national team, this world championship is the first one she participated in. Diao Linyu’s performance is also obvious to all, and she completely pushed Ding Xia to the bench. In the future, with the latter gradually fading out of the national team, Diao Linyu is definitely the first choice for the second pass position. Wang Yun’s words can be regarded as the biggest discovery of China women’s volleyball team. After that, even if Zhu Ting and Zhang Changning come back, she can still lock in the position of the fourth main attack of women’s volleyball team.

Last year’s Tokyo Olympic Games had a great influence on Wang Mengjie, and she was almost retired by fans. Fortunately, she persisted in the end, and seized the opportunity again at this year’s World Championships, becoming the first free agent of the women’s volleyball team again! Although young Yang Hanyu didn’t get as many opportunities as the previous three players in the World Championships, she was basically replaced when the team was in the most difficult time. However, even though there are few opportunities, Yang Hanyu has grasped them well, at least during his playing time, and has a very good performance. Coupled with the lack of strength and performance of Wang Yuanyuan, the starting assistant attacker, Yang Hanyu is likely to replace Wang Yuanyuan in future competitions, and become a candidate for the main assistant attacker of the women’s volleyball team.

After this World Championships, the three players who are likely to leave the national women’s volleyball team, perhaps including the aforementioned Wang Yuanyuan, can only "abuse vegetables". Once she meets an opponent who is stronger than herself, it is difficult to play. The other two players are Jin Ye, a major player, and Wang Weiyi, a free agent. These two players have one thing in common: they are not young. Jin Ye, 26, and Wang Weiyi, 27, can’t be used as future training objects of the team. Besides, they didn’t play very well in this World Championships, and their strength is far from the level of playing the World Series. They should leave their positions to younger and more potential players!

I put the essence of Python coroutine Pa was clean!

This article is a large amount of information, from IO multiplexing, to use the generator, then async, await realization of the principle behind it, in simple terms, the analysis was very thorough, very hardcore!

Two days for personal reasons because it did not touch a long time to write a point of Python, which involves "coroutine" program, the last time out, it is Web framework tornado unique feature, now we have async, await keyword support . Thought about its implementation, reviews the evolution of these years, feel a little bit mean.

They are single-threaded, why the original code with the low efficiency of the async, await add some asynchronous library becomes higher efficiency?

They are single-threaded, why the original code with the low efficiency of the async, await add some asynchronous library becomes higher efficiency?

If you do Python-based network or Web development, this question has puzzled, this article attempts to give an answer.

Before beginning 0x00

Firstly, Not take you browse the source codeAnd then tell you the control to achieve the original code Python standard. Instead, we will set out from the real problems, think of solutions to the problem, step by step evolution path experience solutions, and most importantly, hoping to gain knowledge in a systematic upgrade process.

This article only provides an independent direction of thinking, does not follow the historical and current actual implementation details.

Secondly, you need to read this article familiar with Python, at least understand the concept generator generator of Python.

0x01 IO multiplexing

This is the key to performance. But we are here only to explain the concept, its implementation details is not the point, which we understand Python coroutine enough, as already know enough about, advances to 0x02.

First, you want to know all the network service program is a huge loop, your business logic can be called at some point in this cycle:

defhandler (request):

WHILETRUE:

# Get a new request

request=accept

# To get users to write business logic function according to the route map

Handler=GET_HANDLER (Request)

Handler (Request)

Imagine your Web service of a handler, after receiving a request requires a response to the results of API calls.

For the most traditional network applications, your API requests issued to wait for a response after this time the program stops running, even new requests have to get in after the end of the response. If you rely on an API request packet loss seriously, especially in response to slow it? That will be very low throughput applications.

Many traditional Web server using multi-threading technology to solve this problem: the run handler is placed on other threads, each dealing with a request, this does not affect the new thread blocks request to enter. This problem can be solved to some extent, but for larger systems concurrent, multithreaded scheduling will bring significant performance overhead.

IO multiplexing can be done to solve the problem without the use of threads, it is provided by the operating system kernel functions, we can say specifically for this type of scenario for us. Simply put, your program encounters network IO, tells the operating system to help you staring at, while the operating system gives you a way to make you can feel free to get what IO operation has been completed. like this:

# # 操作 系统 复 复 示 示 例 代代

# Register the ID and type of IO operations to the operating system IO

IO_REGISTER (IO_ID, IO_TYPE)

# Get completed IO operations

Events=IO_GET_FINISHED

For (IO_ID, IO_TYPE) INEvents:

IFIO_TYPE==Read:

Data=read_data (IO_ID)

Elifio_Type==Write:

Write_data (IO_ID, DATA)

Gring the IO multiplex logic into our server, probably like this:

Call_backs={}

Defhandler (REQ):

# do jobs here

DefCall_back (Result):

# Use the returned Result to complete the remaining work …

Call_backs [IO_ID]=CALL_BACK

# New cycle

WHILETRUE:

# Get the completed IO event

IFIO_TYPE==Read: # read

Data=read (IO_ID)

Call_back=call_backs [io_id]

Call_back (data)

Else:

# Other types of IO event processing

PASS

# Get a new request

Handler (Request)

Our Handler has returned immediately for the IO operation. At the same time, each iteration will perform a callback over the completed IO, the network request no longer blocks the entire server.

The pseudo code above is only for understanding, and the details are more complicated. Moreover, it is also possible to connect the new request to the IO event from the operating system to the monitor port.

If we split the cycle part with a call_backs dictionary to a separate module, we can get an EventLoop, which is the iOLOOP provided in the Python Standard Library Asynci.

0x02 with generator to eliminate Callback

He focuses on the Handler function written in our business, after having independent iOLOOP, it now becomes like this:

# 业 业 代 代 … …

# Need an API request

Print (Result)

ask_LOOP.GET_EVENT_LOOP.IO_CALL (API, CALL_BACK)

Here, performance problems have been resolved: We no longer need multi-threads to constantly accept new requests in the source, and don’t have to rely on the API response.

But we have also introduced a new problem. The original business logic code is now demolished. The code before requesting the API is still normal. The code after the request API can only be written in the callback function.

Here our business logic has only one API call. If there are multiple APIs, plus the call to Redis or MySQL (their essential is also a network request), the entire logic will be split, this is a burden on business development .

For some languages ??with anonymous functions (right is Java), it may also trigger a so-called "turning hell".

Next, we find way to solve this problem.

We can easily think that if the function can be suspended after running to the network IO operation, it will wake up at the breakpoint after completion.

If you are familiar with Python’s "Builder", you should find that it happens to have this feature:

Defexample:

Value=yield2

Print ("Get", Value)

ReturnValue

g=esample

# 启 启 生器, we will get 2

Got=G.send (NONE)

Print (got) # 2

TRY:

# Anti-start will display "get 4", which is our incoming value

Got=g.send (got * 2)

ExceptStopItemization ASE:

# Builder runs, will print (4), E.Value is the value of generator return

Print (E.Value)

There is Yield keyword in the function, and the call function will get a generator, and a key method for generator can interact with the generator.

G.send (none) runs the generator code until you encounter Yield, and return to the object, that is, 2, the generator code is stopped here until we perform G.send (got * 2) again, The 2 * 2 is also 4 to assign the value Value in front of Yield, and then continue to run the generator code.

Yield is like a door, you can send a thing from here, you can also take another thing.

If Send makes the generator to run until the next yield is over, the Send call will trigger a special exception STOPITERATION, which comes with a property Value, which is the value of the generator Return.

If we convert our Handler to a generator with Yield keyword, run it to The specific content of IO operationReturns, put the IO result back and restore the generator to run, then solve the problem of uncomfortable business code:

# 业 业 代 代 … …

# Need to execute an API request, directly put the IO request information yield

Result=yieldio_info

# Use the result returned by the API to complete the remaining work

Print (Result)

# This function is registered in iOLOOP, used to call back when there is a new request

Defon_Request (request):

Handler=GET_HANDLER (Request)

g=Handler (Request)

# 首 首 启 获得 获得 i 获得

IO_INFO=G.send (none)

g.send (Result)

ask_LOOP.GET_EVENT_LOOP.IO_CALL (IO_INFO, CALL_BACK)

The above example, the Handler code written by the user will not be dispersed into the callback, and the ON_Request function interacts with Callback and IOLOOP, but it will be implemented in the web framework, which is not visible to the user.

The above code is enough to give us inspiration of Callback destroyed with the builder, but there are two points:

  1. Only a network IO is initiated in business logic, but it is often more

  2. Business logic does not call other asynchronous functions (helping), but in practice, we tend to call other levels.

Let’s take a more complex example:

Among them, Request executes real IO, FUNC1, FUNC2 is only called. Obviously our code can only be written:

Deffunc1:

Ret=yieldfunc2 (re)

returnret

Deffunc2 (DATA):

ReturnResult

DEFREQUEST (URL):

# This simulation returns an IO operation, contains all information about the IO operation, where the string is simplified

Result=yield "IOJOB OF% S"% URL

ReturnResult

For Request, we expose the IO operation to the framework through Yield.

for Func1 and func2, calling request, clearly add Yield keywords Otherwise, the request call returns a generator and will not be paused and continue to perform subsequent logic obviously errors.

This is basically that we don’t write asynchronous code in the Tornado framework without Yield from, Aysnc, AWAIT.

To run the entire calling stack, the approximate process is as follows:

  1. Call FUNC1 to get the generator

  2. Call Send (None) Start it gets the result of request ("http://test.com/foo"), or generator object

  3. Send (none) Starts the generator generated by the request, gets the IO operation, registered by the frame to IOLOOP and specify a callback

  4. The Request Builder wakes up in the callback function after IO, and the generator will go to the return statement end

  5. Capture an exception to get the return value of the Request Builder, wake up the last layer of FUNC1, and get a FUNC2 generator

  6. Continue to execute …

Call FUNC1 to get the generator

Call Send (None) Start it gets the result of request ("http://test.com/foo"), or generator object

Send (none) Starts the generator generated by the request, gets the IO operation, registered by the frame to IOLOOP and specify a callback

The Request Builder wakes up in the callback function after IO, and the generator will go to the return statement end

Capture an exception to get the return value of the Request Builder, wake up the last layer of FUNC1, and get a FUNC2 generator

Continue to execute …

Friends who are familiar with the algorithm and data structure encounter such a traversal logic that will be returned, can be recursively used, because the recursive use generator can not do it, we can use the stack, in fact, this is the word "call stack" origin.

With the stack, we can Connect all generators connected in series in the entire call chain to a generatorFor its constant Send, you can continue to get all IO operation information and drive the call chain advancement, and the implementation method is as follows:

  1. The first generator is in the stack

  2. Call the Send, if you get the generator, you will enter the next round iteration

  3. I encountered IO to ask Yield, let the frame sign up to iOLOOP

  4. After the IO operation is completed, the cache result is forth, enter the next round iteration, the purpose is to restore the upper function using IO results.

  5. If a generator is running, you also need to restore the upper function to the upper function.

The first generator is in the stack

Call the Send, if you get the generator, you will enter the next round iteration

I encountered IO to ask Yield, let the frame sign up to iOLOOP

After the IO operation is completed, the cache result is forth, enter the next round iteration, the purpose is to restore the upper function using IO results.

If a generator is running, you also need to restore the upper function to the upper function.

If implemented, the code is not long but the amount of information is relatively large.

It turns the entire call chain to a generator, calling the send, to complete the IO in the chain, complete these IO, continue to push the logic execution in the calling chain until the overall logic ends:

DEFWrapper (GEN):

# The first layer calls the stack

Stack=stack

Stack.push (gen)

# Start a layer-by-layer call

WHILETRUE:

# Get the top elements of the stack

item=stack.peak

Result=none

IFisgenerator (item):

TRY:

# Try to get the next layer call and get it in the stack

Child=item.send (Result)

Stack.push (child)

# Result Restore to NONE

Result=none

# After entering the stack, enter the next loop directly, continue to explore down

Continue

# If you have an end, you will temporarily save the Result, the next step to make yourself out.

Result=E.Value

Else: # o o operation

# # I 操作 操作, Yield, Io will be woken up and temporarily saved after IO

Result=yieldItem

# 走 到 here, this layer has been completed, out of the stack, the next iteration will be a layer of calling chain

Stack.pop

# 没有有 上, the entire call chain is completed, return

Ifstack.empty:

Print ("finished")

ReturnResult

This may be the most complicated part. If you look hard, it is actually as long as you understand that for the call chain in the example above, it can achieve the effect as follows:

W=Wrapper (Func1)

# Will get "IOJOB of http://test.com/foo"

W.send (none)

# 上 上 ojob foo completed the result "bar" incompart, continue to run, get "IOJOB OF http://test.com/bar"

W.send ("bar")

# 上 上 i i b 完成 完成 传 传 传 传 入 入 入 入 入 入 入 入 入 入 入 入 入

W.send ("BARZ")

With this part, the frame will be added to the matching code:

# Maintain a list of ready lists, store all completed IO events, format is (Wrapper, Result)

Ready=

# After using the wrapper package, you can process IO by Send.

g=wrapper (func1)

# Take the start state directly as the result of NONE

Ready.Append ((g, none))

# Let the iOLOOP perform this function each cycle to handle the ready for IO

Ready.Append ((g, result))

# Traversing all already generators, advance it down

Forg, Result InselF.Ready:

# Use the Result to wake the builder and get the next IO operation

IO_JOB=G.send (Result)

# After the IO operation is complete, add the generator to the ready list, wait for the next round of processing.

ask_LOOP.GET_EVENT_LOOP.IO_CALL (

IO_JOB, LambdareSult: Ready.Append ((g, result)

Here, the core idea is to maintain a list of ready-to-read, and IOLOOP is overwhelmed, and the generator that promotes the ready state is run down, and the new IO operation is registered. After the IO is completed, the ready, after several rounds of Ioloop iteration A Handler will eventually be executed.

At this point, we use the generator to write to write business logic to run normally.

0x04 Improved Scalability

If you can read it here, Python’s scope is basically clear.

We have already achieved one Miniature sweeping frameworkThe realization details of the standard library look great here, but the specific ideas are consistent.

Our equilation framework has a restriction, we can only use IO to operate asynchronously, although in the world of network programming and web programming, the block is basically only IO operation, but there are some exceptions, such as I want the current operation Sleep for a few seconds. The use of time.sleep will make the entire thread to block, requiring special implementation. For example, some CPU-intensive operations can be asynchronously through multi-threaded asynchronous, so that another thread notification event has been completed and followed.

Therefore, it is best to decouple an open space with the network, so that the network IO is only one of the scenes, improves the scalability.

The Python official solution is to let the user hand to block the block code. As for the IOLOOP to register IO event or open a thread completely by yourself, and provide a standard "placeholder" FUTURE, indicating that his results wait for the future Yes, some prototypes are as follows:

ClassFuture:

# Set the result

Defset_Result (Result): Pass

# 获取 结果 结果

Defresult: Pass

# 表示 表示 This Future object is not already set up.

Defdone: Pass

# Set the callback function that should be executed when he is set, you can set multiple

Defadd_done_callback (Callback): Pass

Our slight change can support Future, making the scalability stronger. Network request functions for user code:

# 现在 r es es,, 生 生 器 器 器 器 器 器 器 器

#future is understood as a placeholder

Fut=future

Defcallback (Result):

# Assign the placeholder when the network IO completed the callback

Fut.set_Result (Result)

ask_LOOP.GET_EVENT_LOOP.IO_CALL (URL, CALLBACK)

Now, Request is no longer a generator, but directly returns Future.

And for the function of processing the ready list in the frame:

DEFCALLBACK (FUT):

#future is set to be placed in the ready list

Ready.Append ((g, fut.result))

Fut=g.send (Result)

Fut.add_done_callback (callback)

0x05 development and change

Many years ago, when using Tornado, probably only one Yield keyword is available, the sweeper wants to achieve, that is, this idea, even Yield keywords and return keywords can not appear in a function, you want to run after the generator Returns a value, you need to manually Raise an exception, although the effect is the same as Return now, but it is still very awkward, not elegant.

Later, there was Yield from expression. What can it do?

It is popular, it is done what the generator Wrapper is doing the above: Calling link through the stack, it is the syntax of the Wrapper logic.

With it, the same example you can write:

Deffunc1:

# Note Yield from

Ret=yieldFromRequest ("http://test.com/foo")

# Note Yield from

Ret=yieldfromfunc2 (re)

returnret

Deffunc2 (DATA):

# Note Yield from

Result=yieldfromRequest ("http://test.com/"+data)

ReturnResult

# 同 上 上 实 实 实 实 实 r

Then you no longer need the brainless Wrapper function:

g=func1

# Return the first request for Future

g.send (none)

# Continue to run, automatically enter FUNC2 and get the FUTURE inside it

G.send ("bar")

# Continue to run, complete the residual logic of the call chain, throw the stopiteration exception

G.send ("BARZ")

Yield from the entire call chain directly, it is already great, but it is used asynchronous programming or otherwise, and other languages ??have special-top Async, the AWAIT keyword, until the later version puts these content With dedicated Async, AWAIT keyword packaging, it is a more elegant look today.

0x06 summary and comparison

Overall, Python’s native and trip is achieved from two aspects:

  1. Based on IO multiplexing technology, the entire application is non-blocking on IO, achieving high efficiency

  2. Change the dispersed Callback code through the generator into synchronous code, reducing business writing difficulties

Based on IO multiplexing technology, the entire application is non-blocking on IO, achieving high efficiency

Change the dispersed Callback code through the generator into synchronous code, reducing business writing difficulties

There is a language of the object of the generator. Its IO fight is achieved, the evolution of the Java fight is basically exactly, the keyword is the same, and the Future class is the same than the promise.

However, it is different for this, which is different from this sweeping with the degree of GO-named GO, and does not explicitly based on the generator.

If the class ratio, you can implement the geventime of Python, which is the runtime, and Patch off the system calls to access your own Runtime, you come to the scheduling sweeper, gevent is focused on the network, based on network IO scheduling, relatively simple, The GO achieves perfect multi-core support, more complex and perfect, and creates a new CHANNEL new programming paradigm.

Author: Mao bean peanut

Getting Started: The Most Complete Zero-Basic Python Problem | Zero-Based 8 Months Python | Battle Project | Learning Python is this shortcut

Dry goods: crawling Douban short comment, movie "later we" | 38 years old NBA best player analysis | From Wanzhong to Word! Tang Dynasty 3 disappointment | Laughing to see the new Eti Dragon Slay Dollar | Running Question King | Make a massive Miss in Python Sketch | Disc, I am so fire, I use machine to learn to be a mini recommended system movie

Fun: Poultry Game | Nine Mao Hai | Beautiful Flower | Two-Article Python "Everyday Cool" game!

AI: Robot that will be poetry | Give the picture color | predictive income | Solver, I use the machine to learn to be a mini recommended system movie

Gadget: PDF to Word, easy to get forms and watermarks! | One button saves the HTML page as PDF! Goodbye PDF to extract charges! Use 90 lines of code to create the strongest PDF converter, Word, PPT, Excel, Markdown, HTML one-to-date conversion | Make a staple low-cost ticket prompt! | 60 lines of code made a voice wallpaper switch every day to see a little sister! |

Annual explosion case

  • 1). Lying! PDF to Word Use Python to easily get it!
  • 2) Learn Python is really fragrant! I made a website with 100 lines of code, helping people PS travel pictures, earn a chicken leg to eat
  • 3). The first broadcast over 100 million, hot all net, I analyzed the "Sister Taking Wind and Waves" and found these secrets
  • 4) 80 lines of code! Do a Dream in Python with Python
  • 5). You must master the 20 Python code, short and delicate, useless
  • 6). 30 python hambo skills
  • 7). I summarized 80 "rookie Python selection dry goods.pdf", all dry goods
  • 8). Goodbye Python! I want to learn Go! 2500 word depth analysis!
  • 9). Find a dog welfare! This Python reptile artifact is too cool, automatically download the girl picture