Re: escaping/encoding/formatting in python

2012-05-23 Thread John Nagle
On 4/5/2012 10:10 PM, Steve Howell wrote: On Apr 5, 9:59 pm, rusi wrote: On Apr 6, 6:56 am, Steve Howell wrote: You've one-upped me with 2-to-the-N backspace escaping. Early attempts at UNIX word processing, "nroff" and "troff", suffered from that problem, due to a badly designed macro

Re: escaping/encoding/formatting in python

2012-05-21 Thread rusi
On Apr 6, 10:13 am, Steve Howell wrote: > On Apr 5, 9:59 pm,rusi wrote: > > > On Apr 6, 6:56 am,SteveHowell wrote: > > > > One of the biggest nuisances for programmers, just beneath date/time > > > APIs in the pantheon of annoyances, is that we are constantly dealing > > > with escaping/encoding/f

Re: escaping/encoding/formatting in python

2012-04-07 Thread Chris Angelico
On Sat, Apr 7, 2012 at 3:36 PM, Nobody wrote: > The delimiter can be chosen either by analysing the string > or by choosing something a string at random and relying upon a collision > being statistically improbable. The same techniques being available to MIME multi-part encoders, and for the same

Re: escaping/encoding/formatting in python

2012-04-06 Thread Nobody
On Fri, 06 Apr 2012 06:22:13 -0700, rusi wrote: > But are not such cases rare? They exist, therefore they have to be supported somehow. > For example code such as: > print '"' > print str(something) > print '"' > > could better be written as > print '"%s"' % str(something) Not if the text betw

Re: escaping/encoding/formatting in python

2012-04-06 Thread Serhiy Storchaka
06.04.12 16:22, rusi написав(ла): Yes. I hand it to you that I missed the case of explicitly unbalanced strings. But are not such cases rare? No, unfortunately. }:-( For example code such as: print '"' print str(something) print '"' could better be written as print '"%s"' % str(something)

Re: escaping/encoding/formatting in python

2012-04-06 Thread Serhiy Storchaka
06.04.12 08:28, rusi написав(ла): All this mess would vanish if the string-literal-starter and ender were different. [You dont need to escape a open-paren in a lisp sexp] But you need to escape an escape symbol. -- http://mail.python.org/mailman/listinfo/python-list

Re: escaping/encoding/formatting in python

2012-04-06 Thread rusi
On Apr 6, 1:52 pm, Nobody wrote: > On Thu, 05 Apr 2012 22:28:19 -0700, rusi wrote: > > All this mess would vanish if the string-literal-starter and ender > > were different. > > You still need an escape character in order to be able to embed an > unbalanced end character. > > Tcl and PostScript us

Re: escaping/encoding/formatting in python

2012-04-06 Thread Nobody
On Thu, 05 Apr 2012 22:28:19 -0700, rusi wrote: > All this mess would vanish if the string-literal-starter and ender > were different. You still need an escape character in order to be able to embed an unbalanced end character. Tcl and PostScript use mirrored string delimiters (braces for Tcl, p

Re: escaping/encoding/formatting in python

2012-04-05 Thread rusi
On Apr 6, 10:13 am, Steve Howell wrote: > On Apr 5, 9:59 pm, rusi wrote: > > > On Apr 6, 6:56 am, Steve Howell wrote: > > > > One of the biggest nuisances for programmers, just beneath date/time > > > APIs in the pantheon of annoyances, is that we are constantly dealing > > > with escaping/encod

Re: escaping/encoding/formatting in python

2012-04-05 Thread Steve Howell
On Apr 5, 9:59 pm, rusi wrote: > On Apr 6, 6:56 am, Steve Howell wrote: > > > One of the biggest nuisances for programmers, just beneath date/time > > APIs in the pantheon of annoyances, is that we are constantly dealing > > with escaping/encoding/formatting issues. > > [OT for this list] > If yo

Re: escaping/encoding/formatting in python

2012-04-05 Thread Steve Howell
On Apr 5, 9:59 pm, rusi wrote: > On Apr 6, 6:56 am, Steve Howell wrote: > > > One of the biggest nuisances for programmers, just beneath date/time > > APIs in the pantheon of annoyances, is that we are constantly dealing > > with escaping/encoding/formatting issues. > > [OT for this list] > If yo

Re: escaping/encoding/formatting in python

2012-04-05 Thread rusi
On Apr 6, 6:56 am, Steve Howell wrote: > One of the biggest nuisances for programmers, just beneath date/time > APIs in the pantheon of annoyances, is that we are constantly dealing > with escaping/encoding/formatting issues. [OT for this list] If you run $ find /usr/share/emacs/23.3/lisp/ -name

escaping/encoding/formatting in python

2012-04-05 Thread Steve Howell
One of the biggest nuisances for programmers, just beneath date/time APIs in the pantheon of annoyances, is that we are constantly dealing with escaping/encoding/formatting issues. I wrote this little program as a cheat sheet for myself and others. Hope it helps. # escaping quotes legal_strin