On Sat, Aug 15, 2015 at 07:04:47PM -0500, boB Stepp wrote: > On Sat, Aug 15, 2015 at 6:41 PM, Steven D'Aprano <st...@pearwood.info> wrote: > > On Sat, Aug 15, 2015 at 02:24:21PM -0500, boB Stepp wrote: > > >> I understand your points, but wonder then what is the intended use for > >> os.path.exists()? That is, in what types of circumstances would it be > >> both appropriate and safe to use? > > > > def print_file_names(possible_names): > > print("List of file names checked") > > print("--------------------------" > > for name in possible_names: > > if os.path.exists(name): > > print(name) > > else: > > print("missing:", name) > > <Chuckle!> > > Your example, giving about the most benign possible uses, is for emphasis?
Well, not really. I was trying to think of a case where you want to check whether a file exists but not actually open the file (or at least, not open the file *yet*). -- Steve _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor