Skip to content

Create unique-paths.md#21

Open
tshimosake wants to merge 1 commit intomasterfrom
tshimosake-patch-19
Open

Create unique-paths.md#21
tshimosake wants to merge 1 commit intomasterfrom
tshimosake-patch-19

Conversation

@tshimosake
Copy link
Owner

```py
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
kaijou = [1] * (m + n)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

日本語を変数名に付けた場合、英語話者にとって読みにくくなると思います。 factorial はいかがでしょうか?

if i == 0:
kaijou[0] = 1
continue
kaijou[i] = kaijou[i-1] * i
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

二項演算子の両側のスペースが、コード内で統一されていないのが気になりました。空けるほうに統一することをお勧めいたします。

参考までにスタイルガイドへのリンクを貼ります。

https://peps.python.org/pep-0008/#other-recommendations

Always surround these binary operators with a single space on either side: assignment (=), augmented assignment (+=, -= etc.), comparisons (==, <, >, !=, <=, >=, in, not in, is, is not), Booleans (and, or, not).

https://google.github.io/styleguide/pyguide.html#36-whitespace

Surround binary operators with a single space on either side for assignment (=), comparisons (==, <, >, !=, <>, <=, >=, in, not in, is, is not), and Booleans (and, or, not). Use your better judgment for the insertion of spaces around arithmetic operators (+, -, *, /, //, %, **, @).

上記のスタイルガイドは唯一絶対のルールではなく、複数あるスタイルガイドの一つに過ぎないということを念頭に置くことをお勧めします。また、所属するチームにより何が良いとされているかは変わります。自分の中で良い書き方の基準を持ちつつ、チームの平均的な書き方で書くことをお勧めいたします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants