我知道basic OOP-related topics,RTTI, Templates.从还原回来Java' Collection Framework,我试图找到在这些收藏品C++和发现STL,并想使用它在我的项目(虽然我不知道他们进出).我搜索并找到了类似书籍的推荐Accelerated C++, Effective and More Effective C++.
但我不确定我的进步路径应该是什么.我正在寻找这样的东西 - Python-Progression Path:
Run Code Online (Sandbox Code Playgroud)def apprentice(): read(diveintopython) experiment(interpreter) read(python_tutorial) experiment(interpreter, modules/files) watch(pycon) def master(): refer(python-essential-reference) refer(PEPs/language reference) experiment() read(good_python_code) # Eg. twisted, other libraries write(basic_library) # reinvent wheel and compare to existing wheels if have_interesting_ideas: give_talk(pycon) def guru(): pass # Not qualified to comment. Fix the GIL perhaps?
- 发现列表理解
- 发现发电机
- 包括地图,减少,过滤器,ITER,范围,x范围经常到你的代码 …
$ pydoc re.sub :
sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl.
>>> re.sub('ROAD', 'RD.', 'BRRROADBBRROAD ROAD ROAD MY ROAD')
'BRRRD.BBRRD. RD. RD. MY RD.'
Run Code Online (Sandbox Code Playgroud)
我不太了解python文档中leftmost的含义.据我所看到的,似乎re.sub(...)正在取代所有出现的pattern与repl
块引用来自Java Docs -
FilterInputStream包含一些其他输入流,它将其用作其基本数据源,可能会沿途转换数据或提供其他功能.
DataInputStream允许应用程序以与机器无关的方式从基础输入流中读取原始Java数据类型.
将DataInputStream因此延长FilterInputStream
ObjectInputStream对先前使用ObjectOutputStream编写的基元数据和对象进行反序列化.
但是,由于某种原因,即使它也从底层输入流中读取对象(这次而不是基本类型),它也ObjectInputStream不会扩展FilterInputStream.这是相关课程的分支.

是否有相同的设计推理?
我的log4j.properties文件 -
log4j.rootLogger=INFO, stdout
# =============== console output appender =====================
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %5p: [%c{1}] %m%n
# =================== common logging =========================
# The log level for all classes that are not configured below.
log4j.logger.petascope=INFO
log4j.logger.petascope.wcps=DEBUG
log4j.logger.petascope.wcst=DEBUG
log4j.logger.petascope.wcs=DEBUG
log4j.logger.petascope.wcs2=TRACE
Run Code Online (Sandbox Code Playgroud)
我想在stdout上显示甚至DEBUG和TRACE消息,所以我更改了以下行
log4j.rootLogger=TRACE, stdout
Run Code Online (Sandbox Code Playgroud)
但是当我在Tomcat控制台上查看日志回显时,我没有看到任何变化,我仍然只看到INFO,WARN ...消息.
谷歌文件系统文件 -
块大小是关键设计参数之一.我们选择了64 MB,这比典型的文件系统块大小要大得多.每个块副本都作为普通Linux文件存储在块服务器上,并且仅在需要时进行扩展.惰性空间分配避免了由于内部碎片造成的浪费空间,可能是对这么大的块大小的最大反对.
什么是懒空间分配以及如何解决内部碎片问题?
一个小文件由少量块组成,可能只有一个.如果许多客户端访问同一个文件,那么存储这些块的块服务器可能会变成热点......我们通过存储具有更高复制因子的可执行文件并使批处理队列系统错开应用程序启动时间来解决此问题.
什么是惊人的应用程序启动时间以及它如何避免大块服务器成为热点?
潜入Python -
Python的原作者Guido解释了以这种方式覆盖的方法:"派生类可能会覆盖其基类的方法.因为方法在调用同一对象的其他方法时没有特殊权限,所以基类的方法调用另一种方法在同一个基类中定义的,实际上可能最终调用一个派生类的方法来覆盖它.(对于C++程序员:Python中的所有方法都是虚拟的.)"如果这对你没有意义(它会让人困惑)我的地狱),随意忽略它.我以为我会把它传递给我.
我试图找出一个例子:一个基类的方法调用在同一个基类中定义的另一个方法,实际上可能最终调用一个派生类的方法来覆盖它
class A:
def foo(self): print 'A.foo'
def bar(self): self.foo()
class B(A):
def foo(self): print 'B.foo'
if __name__ == '__main__':
a = A()
a.bar() # echoes A.foo
b = B()
b.bar() # echoes B.foo
Run Code Online (Sandbox Code Playgroud)
......但这两者似乎都很明显.
我错过了引用中暗示的内容吗?
编辑了在原始代码中调用a.foo()(而不是a.bar())和b.foo()(而不是b.bar())的错字
阅读后: 深入Python:Unicode讨论
我很好奇尝试打印我的名字indic script.我正在使用v2.7.2-
>>> import sys
>>> sys.getdefaultencoding()
'ascii'
>>> name = u'\u0935\u0948\u092D\u0935'
>>> print name
????
Run Code Online (Sandbox Code Playgroud)
我期待print name给我UnicodeError,因为defaultencoding被设置为ASCII使自动强迫ASCII从Unicode不应该工作.
我错过了什么?
这不是一个正常的工作流程吗?
[default] $ hg branch foo
[foo] $ [... some commits ...]
[foo] $ hg update default
[default] $ hg merge foo
[default] $ hg commit -m "merged foo"
[default] $ hg push
abort: push creates new remote branches: foo!
(use 'hg push --new-branch' to create new remote branches)
Run Code Online (Sandbox Code Playgroud)
什么是分支→合并→推动的理想方式?
Mercurial 默认会推/拉所有分支,而 git 只会推/拉当前分支。
不知我的理解是否正确:
我突然想到,当我执行 a 时,git pull我实际上是 fetch从所有分支执行的,但merge只发生在我所在的当前分支上。这是非常接近mercurial,其中一个pull让我一切从遥远; 但还没有 merge什么。
在mercuriala 中push发送所有内容,但需要显式将内容update合并回来。我不太确定操作的git'行为push。
从python 文档中我看到它dict有一个update(...)方法,但它似乎没有异常,我可能不想用新值更新旧字典.例如,当值为None.
这就是我目前所做的事情:
for key in new_dict.keys():
new_value = new_dict.get(key)
if new_value: old_dict[key] = new_value
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来使用新词典更新旧词典.