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是什么”

Advertisements

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”

程序员的核心竞争力是什么?


文章引用自知乎张砷镓

在进行社招面试时,有一个问题几乎是必问的:

你为什么要离开上一家公司?

其实这个问题主要是想试探一下求职者的核心诉求,并借此预估一下他在本公司工作的稳定性。常见的答案也无非就是这么几种:对薪酬不满意、干得不爽,或者是想换个环境。

然而,我遇到过好几个初次跳槽的求职者给出的答案是:「在原来的公司学不到技术」

一听到这个,我就不由得叹口气:今天这一小时又算是交代了,这人基本上没戏。因为根据我的经验,这句话如果由工作不满两年的人说出来,很大概率这是个不会学习不会感恩又特别爱抱怨的人。 Continue reading “程序员的核心竞争力是什么?”