Skip to main content
11 events
when toggle format what by license comment
Nov 29, 2022 at 16:09 history edited Toby Speight
edited tags
Apr 21, 2016 at 9:12 vote accept user1685095
Apr 20, 2016 at 17:20 history edited 200_success CC BY-SA 3.0
edited tags; edited title
Apr 20, 2016 at 13:13 answer added 301_Moved_Permanently timeline score: 2
Apr 20, 2016 at 12:27 comment added 301_Moved_Permanently @user1685095 Yes, obviously it is a context manager returning an SMTP connection. But why do you need it? What are your needs that lead you to that? How do you use it? I also don't really understand the relation between your code and the two snippets below it (except the fact that they both use contextlib resources). The more context you provide, the more interesting answers you’ll be able to get. (and optionally the more users will be insterested into giving such an answer.)
Apr 20, 2016 at 10:11 comment added user1685095 @JoeWallis that's what contextmanager decorator is for. To simplify enter and exit stuff.
Apr 20, 2016 at 10:10 comment added user1685095 @MathiasEttinger I think the code is self explanatory. It's context manager that return SMTP connection. Isn't that obvious?
Apr 20, 2016 at 9:55 comment added Peilonrayz IIRC they added __enter__ and __exit__ for this pattern.
Apr 20, 2016 at 9:49 comment added 301_Moved_Permanently Welcome to Code Review! This question is incomplete. To help reviewers give you better answers, please add sufficient context to your question. The more you tell us about what your code does and what the purpose of doing that is, the easier it will be for reviewers to help you. Questions should include a description of what the code does
Apr 20, 2016 at 9:34 review First posts
Apr 20, 2016 at 13:10
Apr 20, 2016 at 9:31 history asked user1685095 CC BY-SA 3.0