Skip to content

Conversation

@Mike0121
Copy link
Owner

Copy link

Choose a reason for hiding this comment

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

先に split したほうが replace の長さが減るのでは。

Copy link
Owner Author

Choose a reason for hiding this comment

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

Odaさん、ありがとうございます。
問題文の流れの通りに書いておりました。ご指摘の通りですね。

Choose a reason for hiding this comment

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

oroginal_local[i] != '+' を and 条件に加えるよりも、'+' が来たら break するように書いたほうが見やすい気がします。

Choose a reason for hiding this comment

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

上記実施すれば、while 文から for 文に書き換えられそうです。そうすると i を宣言する必要もないですね。

Copy link
Owner Author

Choose a reason for hiding this comment

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

たしかに、その書き方であれば変数減らせますね。ありがとうございます。

Choose a reason for hiding this comment

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

説明文には引数に渡される部分が local name とあるので、address を name に変えたほうがいいと思いました。
そもそも local name の部分だけだと address としての役割は果たせないので、この単語が入ることにちょっと違和感を感じます🙏

Choose a reason for hiding this comment

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

oroginal_local[i] == '.' を満たす時に continue する書き方にするのも良さそうです。

Choose a reason for hiding this comment

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

Python の文字列型って immutable じゃなかったでしたっけ?あまり詳しくないので間違っていたらすいません。
もし immutable だと、この行が実行されるたびに文字列型の値が生成されてしまうので、修正したほうがいいと思います。

Choose a reason for hiding this comment

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

他の方に同じコメントをしたら oda さんから返信がありました。ちゃんと見て後ほど返信しますが、仰られてる通りあまり適切でないレビューだった気がしています... すいません🙏
SuperHotDogCat/coding-interview#30 (comment)

Choose a reason for hiding this comment

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

メソッドチェーンにするとデバッグがしづらくなるので、replace、split は別の行でそれぞれ処理しても良さそうです。

Copy link
Owner Author

Choose a reason for hiding this comment

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

ありがとうございます。そうですね、ちょっと見づらいと思いので、replace、splitに分けるとより良いですね。

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.

4 participants