[Python-bugs-list] [ python-Feature Requests-784509 ] interpret
string argument as filename
SourceForge.net
noreply at sourceforge.net
Mon Aug 11 18:49:52 EDT 2003
Feature Requests item #784509, was opened at 2003-08-06 20:19
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=784509&group_id=5470
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Russ Thompson (russt)
Assigned to: Nobody/Anonymous (nobody)
Summary: interpret string argument as filename
Initial Comment:
I think it would be great if, in general, anywhere
a python function asks for a file object, supplying
a string would be interpreted as a filename.
For example, one can do:
cPickle.dump('mypicklefile', myobject)
instead of:
f=file('mypicklefile','w')
cPickle.dump(f,myobject)
f.close()
Much faster in an interactive session! And very
easy to implement. And similarly for cPickle.load()
and lots of other functions. Pickling of multiple
objects could still be accomplished through the
long form above.
Thanks,
-Russ
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-08-11 19:49
Message:
Logged In: YES
user_id=80475
I prefer leaving the functions as they are now because:
* the current way supports and encourages explicit file
closing
* supporting this everywhere would unnecessarily complicate
the code
* munging parameters unnecessarily confuses/complicates
the API
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=784509&group_id=5470
More information about the Python-bugs-list
mailing list