Objections to print >>file syntax from a complete newbie. (And question about raw strings and dos filenames)

John Krukoff jkrukoff at ltgc.com
Thu May 17 19:10:35 EDT 2001


Hi everybody,

I've just started my first programming project with python, and I was
thinking about the print >>file syntax. As I've been learning python
nothing else has stood out so much as being an odd, unusual, and inelegant
syntax as this. Both the oddity of it being position and special character
dependant, as well as it being part of the argument list to print. It
feels like dealing with an overloaded function rather than dealing with
the other python statements. After taking a look at the PEP documents, I
was wondering why a syntax parallel to the other location specifying
command, import (as in from modulename import name ) wasn't mentioned?
Something like

in stdout print name

or something similar, so as to avoid the special characters and the need
for adding it to the argument list.

Also, not being able to have a backslash on the end of a raw string has
been frustrating. I'm using a couple of hard coded DOS filenames and raw
strings seemed like a good way save on typing, but by design they can't go
at the end of the string. Does anybody have a better method than using
strip? As in

filename = r"c:\mydir\ ".strip()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3014 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20010517/91457e7f/attachment.bin>


More information about the Python-list mailing list