From e1ab5ddc2238bb5d3a57a5b70f4c4901e3696147 2012-06-01 12:42:09 From: Matthias BUSSONNIER Date: 2012-06-01 12:42:09 Subject: [PATCH] use tuple in str.endwith --- diff --git a/IPython/core/magics/code.py b/IPython/core/magics/code.py index b119993..6e2e082 100644 --- a/IPython/core/magics/code.py +++ b/IPython/core/magics/code.py @@ -70,7 +70,7 @@ class CodeMagics(Magics): raw = 'r' in opts ext = u'.ipy' if raw else u'.py' fname, codefrom = unquote_filename(args[0]), " ".join(args[1:]) - if not (fname.endswith(u'.py') or fname.endswith(u'.ipy')): + if not fname.endswith((u'.py',u'.ipy')): fname += ext if os.path.isfile(fname): overwrite = self.shell.ask_yes_no('File `%s` exists. Overwrite (y/[N])? ' % fname, default='n')