小编Sem*_*ark的帖子

git 交互式变基 - 编辑与中断

我试过谷歌搜索这个,但无法找到满意的答案。

我想知道有什么区别之间edit,并break在交互模式git rebase -i

根据评论,edit使用commit,但停止修改,而break在指定位置停止。但是有什么区别:

# Scenario 1

pick a9ca198 commit #1
pick 15948d1 commit #2
edit 2dbe941 commit #3  // this will apply commit #3 and then stop.
pick 33c012d commit #4
Run Code Online (Sandbox Code Playgroud)
# Scenario 2

pick a9ca198 commit #1
pick 15948d1 commit #2
pick 2dbe941 commit #3
break                   // this will stop after commit #3
pick 33c012d commit #4
Run Code Online (Sandbox Code Playgroud)

我已经尝试过它们,对我来说,它们似乎完全相同。

git rebase git-rebase

9
推荐指数
1
解决办法
1197
查看次数

C++ Qt creator 我可以评论每一行,而不是只评论选择吗?

我想这个问题以前肯定有人问过,但我找不到。

所以在 Qt creator 中,假设我有一些这样的代码:

int var1;
int var2;
for (int i = 0; i < 10; i++) {
    // do sth
}
Run Code Online (Sandbox Code Playgroud)

当我从第一行的开头到最后一行的结尾选择一堆行并切换注释时,我得到以下信息:

// int var1;
// int var2;
// for (int i = 0; i < 10; i++) {
//     // do sth
// }
Run Code Online (Sandbox Code Playgroud)

但是当我从第一行的中间选择时,我得到了这样的信息:

int v/*ar1;
     ^ note the /*

int var2;
for (int i = 0; i < 10; i++) {
    // do sth
}*/
 ^ and */
Run Code Online (Sandbox Code Playgroud)

我想要的是,从选择的每一行的开头使用 // 使用 Qt 创建者注释,就像第一个示例一样。

有没有办法做到这一点?对于我过去使用过的所有 IDE …

c++ qt

6
推荐指数
1
解决办法
1924
查看次数

在print()中的end ='...'键不是线程安全的吗?

使用下面的代码,我尝试使用a在jupyter-notebook上并行打印一堆东西ThreadPoolExecutor.请注意,使用该功能show(),输出不是您通常所期望的.

from concurrent.futures import ThreadPoolExecutor
import sys

items = ['A','B','C','D','E','F',
         'G','H','I','J','K','L',
         'M','N','O','P','Q','R',
         'S','T','U','V','W','X','Y','Z']

def show(name):
    print(name, end=' ')

with ThreadPoolExecutor(10) as executor:
    executor.map(show, items)

# This outputs
# AB  C D E F G H I J KLMNOP      QR STU VW    XY Z 
Run Code Online (Sandbox Code Playgroud)

但是当我尝试时sys.stdout.write(),我没有得到这种行为.

def show2(name):
    sys.stdout.write(name + ' ')

with ThreadPoolExecutor(10) as executor:
    executor.map(show2, items)

# This gives
# A B C D E F G H I J K L M N …
Run Code Online (Sandbox Code Playgroud)

python python-3.x jupyter jupyter-notebook

5
推荐指数
1
解决办法
92
查看次数

标签 统计

c++ ×1

git ×1

git-rebase ×1

jupyter ×1

jupyter-notebook ×1

python ×1

python-3.x ×1

qt ×1

rebase ×1