Skip to content

929. Unique Email Addresses - #6

Open
tsadamor wants to merge 1 commit into
mainfrom
0929-unique-email-addresses
Open

929. Unique Email Addresses#6
tsadamor wants to merge 1 commit into
mainfrom
0929-unique-email-addresses

Conversation

@tsadamor

Copy link
Copy Markdown
Owner

- [ユースケースの想定](https://discord.com/channels/1084280443945353267/1251052599294296114/1254245440690589787)
- この次元では考えられていなかった。
- 今回の自分のコードはエラーを吐いていないので(結果として)サービス向け、[データサイエンスならそうでもない](https://discord.com/channels/1084280443945353267/1355903616032178327/1370028729186910269)
- 同じような話として、今回は'@'がひとつと保証されているけれど、実際の使用を想定するなら`split('@', 1)`にしたほうがよさそう

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

email address豆知識として,RFCで一応フォーマットが定められていることは知っておいてもいいかもです.

あとはコーディングテストでは使うことを想定されていないと思いますが,
標準ライブラリにあるので,実務上はこちらを使うべきと思います.このページ,RFCとかについても言及されているので,ざっと眼を通すとよさそうです
https://docs.python.org/3/library/email.html

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ざっと見てみましたが,parserはあるものの,addressのvalidationに相当する関数がなかったかもしれません.
ので,この部分は無視してください

標準ライブラリにあるので,実務上はこちらを使うべきと思います.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

RFCが種々のプロトコルを定めているということも知らなかったので勉強になりました。

if c == "+":
break
parsed_local.append(c)
parsed_local = "".join(parsed_local)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

parsed_localの型が変わっているので,すこし戸惑いますね.

normalized_local, canonicalized_localなどの変数を宣言するなどしてもいいかもしれません

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

たしかに型が変わるときに同じ名前に再代入すべきではないですね。ありがとうございます。

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