homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients eric.smith, iritkatriel, miss-islington, ncoghlan, serhiy.storchaka, vstinner
Date 2020年10月09日.15:02:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602255752.62.0.889214959109.issue34067@roundup.psfhosted.org>
In-reply-to
Content
For the original problem, how about this?
 def process_file(file_or_path):
 if isinstance(file_or_path, str):
 # If string, open file
 cm = open
 else:
 # Caller is responsible for closing file
 cm = nullcontext
 with cm(file_or_path) as file:
 # Perform processing on the file
History
Date User Action Args
2020年10月09日 15:02:32iritkatrielsetrecipients: + iritkatriel, ncoghlan, vstinner, eric.smith, serhiy.storchaka, miss-islington
2020年10月09日 15:02:32iritkatrielsetmessageid: <1602255752.62.0.889214959109.issue34067@roundup.psfhosted.org>
2020年10月09日 15:02:32iritkatriellinkissue34067 messages
2020年10月09日 15:02:32iritkatrielcreate

AltStyle によって変換されたページ (->オリジナル) /