量产型炮灰工程师


来源量产型炮灰工程师 – 知乎专栏

为啥要转载这篇文章呢?因为很多人毫无编程基础的朋友,不打好基础,

追求所谓的项目训练套路,这样的训练结果是连基本的循环都写不好,

在开发项目时,还是狗咬刺猬无从下手。 Continue reading “量产型炮灰工程师”

Advertisements

python装饰器


题图来自Dobiasd的article项目聊到的Python的学习曲线,虽然作者说” The only purpose of this is to entertain. It has no empirical base whatsoever. “,但是我觉得还是需要重视文章中提到的一个说法:python掌握程度的评价标准中肯定包含装饰器。装饰器是python语言的语法糖,没有它并不会影响python编程,但作为评价标准之一,我想自己还是要能够回答下述几个问题:
1.Python装饰器有什么用?
2.Python装饰器是什么?
3.Python装饰器实现的原理是什么?
4.Python装饰器有哪几种具体形式?
5.Python装饰器有哪些应用场景?
6.Python装饰器在著名开源项目中的应用?

这就是这篇文章的由来。
Continue reading “python装饰器”

Python container是什么


Some objects contain references to other objects; these are called containers. Examples of containers are tuples, lists and dictionaries. The references are part of a container’s value. In most cases, when we talk about the value of a container, we imply the values, not the identities of the contained objects; however, when we talk about the mutability of a container, only the identities of the immediately contained objects are implied. So, if an immutable container (like a tuple) contains a reference to a mutable object, its value changes if that mutable object is changed.

Continue reading “Python container是什么”

Python 编码错误根因分析


Python编程特别是网页解析时一定遇到过UnicodeEncodeError、UnicodeDecodeError 错误,每当遇到错误我就拿 encode、decode 函数翻来覆去的转换,有时试着试着问题就解决了,有时候怎么试都解决不了,为了避免下次遇到类似的问题重蹈覆辙,所以需要分析清楚 Python 字符编码错误的根因。 Continue reading “Python 编码错误根因分析”

GCC中的环境变量LIBRARY_PATH和LD_LIBRARY_PATH


编译链接时的环境变量LIBRARY_PATH, LD_LIBRARY_PATH的官方说明:

LIBRARY_PATH

The value of LIBRARY_PATH is a colon-separated list of directories, much like PATH. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it cannot find them using GCC_EXEC_PREFIX. Linking using GCC also uses these directories when searching for ordinary libraries for the -l option (but directories specified with -L come first).

LD_LIBRARY_PATH

A list of directories in which to search for ELF libraries at execution-time. The items in the list are separated by either colons or semicolons. Similar to the PATH environment variable. This variable is ignored in secure-execution mode.
Within the pathnames specified in LD_LIBRARY_PATH, the dynamic linker expands the tokens $ORIGIN, $LIB, and $PLATFORM (or the versions using curly braces around the names) as described above in Rpath token expansion. Thus, for example, the following would cause a library to be searched for in either the lib or lib64 subdirectory below the directory containing the program to be executed:
$ LD_LIBRARY_PATH='$ORIGIN/$LIB' prog
(Note the use of single quotes, which prevent expansion of $ORIGIN and $LIB as shell variables!)

Continue reading “GCC中的环境变量LIBRARY_PATH和LD_LIBRARY_PATH”