trouble understanding None

Peter Otten __peter__ at
Thu Nov 13 01:38:43 CET 2003

Terry Reedy wrote:

> Unless the OP actually needs a list of lines, I think I would make the
> value corresponding to each letter one string with embedded newlines:
> This is very easy to edit (with a fixed pitch editor), aud to use.

Yes, this would be a cleaner approach.

> The only real problem is (maybe) the extra newline at the beginning of
> the file, which makes the first line line-up with the rest.  The raw
> mode input makes it impossible (as far as I know) to escape it (with
> the usual '\', which gets printed instead).  So one could either
> postprocess the dict to slice all values or delete the initial newline
> in the source code after getting the letter right.

I mixed normal and raw strings because I recalled a problem with backslashes
at the end of a raw string. I've since found out that this applies only to
a single last backslash at the end of the string:

>>> r"\\"
>>> r"\"
  File "<stdin>", line 1
SyntaxError: EOL while scanning single-quoted string

For my Big writer class , that somewhat extends the original task,
postprocessing would be the way to go, because of other problems:

- every line of a character must be of the same length
- every character must have the same height
- if character definitions with different heights are allowed, additional
information about the baseline is required for the program to decide where
to fill in the blank lines


More information about the Python-list mailing list