[Python-Dev] Fwd: PEP 310(with-syntax): close synonym of __exit__
Guido van Rossum
guido at python.org
Tue Aug 26 14:06:54 EDT 2003
More information about the Python-Dev mailing list
Tue Aug 26 14:06:54 EDT 2003
- Previous message: [Python-Dev] Fwd: PEP 310(with-syntax): close synonym of __exit__
- Next message: [Python-Dev] Fwd: PEP 310(with-syntax): close synonym of __exit__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Btw, if __exit__ is the only spelling then: > > var = expr > > if hasattr(var, "__enter__"): > var.__enter__() > > try: > suite > > finally: > var.__exit__() > > is maybe a better semantics. If someone uses some of his legacy > file-like objects etc, but forgets to define at least __exit__, he > gets a fail-fast behavior, otherwise he may have to track down data > corruption or something like that... Good idea! --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Fwd: PEP 310(with-syntax): close synonym of __exit__
- Next message: [Python-Dev] Fwd: PEP 310(with-syntax): close synonym of __exit__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list