929. Unique Email Addresses - #6
Open
tsadamor wants to merge 1 commit into
Open
Conversation
miyataka
reviewed
Jul 26, 2026
| - [ユースケースの想定](https://discord.com/channels/1084280443945353267/1251052599294296114/1254245440690589787) | ||
| - この次元では考えられていなかった。 | ||
| - 今回の自分のコードはエラーを吐いていないので(結果として)サービス向け、[データサイエンスならそうでもない](https://discord.com/channels/1084280443945353267/1355903616032178327/1370028729186910269) | ||
| - 同じような話として、今回は'@'がひとつと保証されているけれど、実際の使用を想定するなら`split('@', 1)`にしたほうがよさそう |
There was a problem hiding this comment.
email address豆知識として,RFCで一応フォーマットが定められていることは知っておいてもいいかもです.
あとはコーディングテストでは使うことを想定されていないと思いますが,
標準ライブラリにあるので,実務上はこちらを使うべきと思います.このページ,RFCとかについても言及されているので,ざっと眼を通すとよさそうです
https://docs.python.org/3/library/email.html
There was a problem hiding this comment.
ざっと見てみましたが,parserはあるものの,addressのvalidationに相当する関数がなかったかもしれません.
ので,この部分は無視してください
標準ライブラリにあるので,実務上はこちらを使うべきと思います.
Owner
Author
There was a problem hiding this comment.
RFCが種々のプロトコルを定めているということも知らなかったので勉強になりました。
| if c == "+": | ||
| break | ||
| parsed_local.append(c) | ||
| parsed_local = "".join(parsed_local) |
There was a problem hiding this comment.
parsed_localの型が変わっているので,すこし戸惑いますね.
normalized_local, canonicalized_localなどの変数を宣言するなどしてもいいかもしれません
Owner
Author
There was a problem hiding this comment.
たしかに型が変わるときに同じ名前に再代入すべきではないですね。ありがとうございます。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://leetcode.com/problems/unique-email-addresses/description/?envType=problem-list-v2&envId=xo2bgr0r