Functions and Reasons for Using pyenv # pyenv is a tool used to install various versions of Python on a system,
and to conveniently switch between Python versions.
When you need to develop or maintain projects that require different Python versions simultaneously,
you will need to use pyenv to help switch Python versions.
New Python versions usually include syntax updates or new features.
Before the advent of asyncio,
when a Python program had many tasks that needed to be executed concurrently,
and wanted to improve program performance,
the only options were multiprocessing or threading.
After Python 3.4, asyncio became another option.
asyncio can be used to write coroutines,
and execute coroutines concurrently using an event loop,
reducing unnecessary waiting time in the program to improve performance.
Why Pipenv # When maintaining many Python projects,
different projects might use different versions of the same Python libraries.
Not using a virtual environment and installing all Python modules directly on your machine will lead to version conflicts.
In the past, the mechanism of virtualenv + requirements.txt allowed different projects to use different versions of the same package,
and also enabled new developers or production environments to quickly install the packages required by the project.
Shallow Copy # Copies as little as possible.
A new structure created by a shallow copy has the same structure as the old one,
and they share the memory address of elements.
For example, in Java:
int[] arr1 = {1, 2, 3}; int[] arr2 = arr1; arr2 is a shallow copy of arr1.
If one of the structures modifies an element, the other will also be affected. Deep Copy # Copies everything.
A new structure created by a deep copy not only has the same structure as the old one,
but also copies all elements of the old structure to the new memory address.
Introduction # C++ provides various containers to store and manage data,
each with its unique characteristics and applicable scenarios.
This article will delve into five common sequence containers: array, vector, deque, list, and forward_list,
comparing their features, performance, and offering selection advice.
Array # std::array is a fixed-size array introduced in C++11,
combining the performance of C-style arrays with the interface of STL containers.
Update # I’ve moved from Jekyll to Hugo.
This method is only applicable to Jekyll.
Sitemap # A sitemap is an .xml file that contains links to all the pages within a website.
With a sitemap,
a search engine can discover the pages and subsequently create indexes for them.
Then, people browsing the internet can find those pages using keywords.
Jekyll-sitemap # There is a plugin called jekyll-sitemap for Jekyll,
which automatically generates a sitemap whenever the website is rebuilt.
const with Normal Variables # Two ways to add const for normal variables:
const TYPE NAME = VALUE; // more common TYPE const NAME = VAULE; Both mean this variable cannot be assigned to another value.
For example,
Both ‘Concurrent Processing’ and ‘Parallel Processing’ refer to multiple processes executing on the CPU within a period,
but they are two different things.
According to The Art of Concurrency,
Concurrent means: