A command line parameter?? The annoying part would be telling every single user to call Python with a certain argument and hope they read the README.
If it's a library, out of the question. If it's a program, well, I hope your users read READMEs. On Fri, Jan 17, 2014 at 4:49 AM, Neil Schemenauer <n...@arctrix.com> wrote: > As I see it, there are two separate goals in adding formatting > methods to bytes. One is to make it easier to write new programs > that manipulate byte data. Another is to make it easier to upgrade > Python 2.x programs to Python 3.x. Here is an idea to better > address these separate goals. > > Introduce %-interpolation for bytes. Support the following format > codes to aid in writing new code: > > %b: insert arbitrary bytes (via __bytes__ or Py_buffer) > > %[dox]: insert an integer, encoded as ASCII > > %[eEfFgG]: insert a float, encoded as ASCII > > %a: call ascii(), insert result > > Add a command-line option, disabled by default, that enables the > following format codes: > > %s: if the object has __bytes__ or Py_buffer then insert it. > Otherwise, call str() and encode with the 'ascii' codec > > %r: call repr(), encode with the 'ascii' codec > > %[iuX]: as per Python 2.x, for backwards compatibility > > Introducing these extra codes and the command-line option will > provide a more gradual upgrade path. The next step in porting could > be to examine each %s inside bytes literals and decide if they > should either be converted to %b or if the literal should be > converted to a unicode literal. Any %r codes could likely be safely > changed to %a. > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com > -- Ryan When your hammer is C++, everything begins to look like a thumb.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com