Adam Cripps said unto the world upon 2005-03-06 02:38:
On Fri, 04 Mar 2005 12:14:28 -0500, Brian van den Broek
<[EMAIL PROTECTED]> wrote:

Kevin said unto the world upon 2005-03-04 10:43:

Hello all. I have just completed my very first python program just a
simple number guessing. I would like for someone to try it out if they
could and let me know how I did with it and where I could have
improved apon it. There are t files main.py and defs.py

Thanks

Hi Kevin,

Though I am a learner, too, I have a few comments. They are more about
style than substance.

1) A lot of your code comments get in the way of my reading and easily
understanding the code. Consider:

.# leading `.'s to foil google groups and other whitespace stripping
readers

<SNIP>

<snip>

Is the tutor list mirrored on usenet such as google groups? I've
searched and not found it. I think it's a bit harsh to blame the style
on a client that strips white-space, where he has no control over it.
Are we not better off using another client?

Hi Adam,

I don't know if tutor is viewable through google groups or not. However, it has proved a problem on comp.lang.python, where I picked up the leading '.' trick. Noting that Kevin (the OP) was using a gmail account and not knowing if the google groups' leading whitespace stripping `feature' was also a gmail feature, I figured it would be better to be safe and put the possibly needless '.'s in.

It would indeed have been harsh to complain about his whitespace if it were google-striped whitespace at issue. But, when I commented upon the lack of whitespace in his code, I said

B> Whitespace is a good thing. Python needs it horizontally, but
B> you can (and, IMHO, should) employ vertical whitespace to chunk
B> up the code.

So, it is a different issue.

I use gmail to collect this kind of email and using the recent thread
entitle "Reading Tutor with gmail: monospace fonts" have managed to
make my mail monospace, which makes it a lot easier to read. None of
the whitespace was stripped in my mail, and the style looked fine.

That is good to know; I won't worry next time.


In fact, by littering it with '.' you are making it more of a task to run
this script, as you have to strip all the '.' out first - a real pain.

A bummer, yes. And one to blame on google groups -- it is much less of a pain than loosing all leading whitespace. But, not too much a pain, either (we are programming here, right ;-) :


<untested code>
# assuming the code has been saved to a .py file whose lines
# are available for iteration in python_file

stripped_lines = []

for line in python_file:
    if line.startswith('.'):
        line = line[1:]
    stripped_lines.append(line)

# write the stripped_line to the original .py file, and you're
# good to go.
</code>

Best,

Brian vdB

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to