Re: Wrapping comments

2009-07-05 Thread Michael Torrie
Lawrence D'Oliveiro wrote:
 I tried using Emacs via SSH from a Mac once. Made me run screaming for the 
 nearest Windows box 
 http://groups.google.co.nz/group/comp.sys.mac.advocacy/msg/dfad8bff6942e749.

Interesting rant, but the problem is with the key bindings they chose to
use in Terminal.app program. Fortunately in leopard most of the problems
are now fixed, or can be configured to work in a non-broken fashion.
The rest of us, in the meantime, all switched to iTerm which, although
had some performance issues, behaved like we all expected terminals to
behave.

As far as terminal hell goes, I regularly find that when ssh-ing to
remote boxes that backspace doesn't work.  Or does in bash (because it's
 smart enough to play games) but not in vim.  Somehow sometimes over ssh
the key bindings for backspace get lost of messed up.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-07-05 Thread Lawrence D'Oliveiro
In message mailman.2656.1246832876.8015.python-l...@python.org, Michael 
Torrie wrote:

 Lawrence D'Oliveiro wrote:

 I tried using Emacs via SSH from a Mac once. Made me run screaming for
 the nearest Windows box
 
http://groups.google.co.nz/group/comp.sys.mac.advocacy/msg/dfad8bff6942e749.
 
 Interesting rant, but the problem is with the key bindings they chose to
 use in Terminal.app program.

Except for control-space, which was defined systemwide to bring up 
Spotlight. So you can't blame the Terminal app for that. The brain damage 
was more widespread than just one program.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-12 Thread Lawrence D'Oliveiro
In message towb-4f1754.17464609052...@news.individual.de, Tobias Weber 
wrote:

 In article 02159679$0$20647$c3e8...@news.astraweb.com,
  Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
 
 Maybe in another 20 years, nobody will care about low-level details like
 the characters used to write code. Only the tokens really matter.
 
 You could have that ten years ago with AppleScript. Gets annoying
 quickly...

To me, the annoying thing about the AppleScript Script Editor wasn't the 
tokenization, it was its insistence on overriding my decisions about where 
to continue a line.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-12 Thread Lawrence D'Oliveiro
In message towb-63ce3d.09322210052...@news.individual.de, Tobias Weber 
wrote:

 (still not gonna use software that doesn't let me type # because it's
 alt+3 on a UK layout; having to re-learn or configure that is just sick)

Tried typing compose-plus-plus?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-12 Thread Lawrence D'Oliveiro
In message slrnh0fqu4.qcl.n...@irishsea.home.craig-wood.com, Nick Craig-
Wood wrote:

 Rhodri James rho...@wildebst.demon.co.uk wrote:

  Emacs is my editor of choice ...
 
 You probably haven't used MAC OS X then!

I tried using Emacs via SSH from a Mac once. Made me run screaming for the 
nearest Windows box 
http://groups.google.co.nz/group/comp.sys.mac.advocacy/msg/dfad8bff6942e749.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-12 Thread Piet van Oostrum
 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand (LD) wrote:

LD In message slrnh0fqu4.qcl.n...@irishsea.home.craig-wood.com, Nick Craig-
LD Wood wrote:

 Rhodri James rho...@wildebst.demon.co.uk wrote:
 
 Emacs is my editor of choice ...
 
 You probably haven't used MAC OS X then!

LD I tried using Emacs via SSH from a Mac once. Made me run screaming for the 
LD nearest Windows box 

The standard Windows box doesn't even have SSH AFAIK.

I edit remote files on my local Emacs on Mac OS X with tramp,
certainly when they are on a SSH-accessible machine.
Works like a charm.
-- 
Piet van Oostrum p...@cs.uu.nl
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-11 Thread Nick Craig-Wood
Rhodri James rho...@wildebst.demon.co.uk wrote:
  On Sun, 10 May 2009 08:32:23 +0100, Tobias Weber t...@gmx.net wrote:
 
  In article m2bpq2ngup@googlemail.com,
   Arnaud Delobelle arno...@googlemail.com wrote:
 
  A simple Alt-Q will reformat everything nicely.
 
  Now that's something. Thanks!
 
  (still not gonna use software that doesn't let me type # because it's
  alt+3 on a UK layout; having to re-learn or configure that is just sick)
 
  What on earth are you talking about?  '#' has its own key on a UK layout
  (shared with '~', but you know what I mean), just to the left of the
  RETURN key.  Emacs is my editor of choice, and I've never once come
  across anything like this.

You probably haven't used MAC OS X then!  I vnc to a mac and use emacs
and I just can't type a #.  Ctrl-Q 43 Return is my best effort!

-- 
Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-11 Thread norseman

Tobias Weber wrote:

Hi,
the guideline (PEP 8) is hard wrap to 7x characters. The reason given is 
that soft wrap makes code illegible.


So what if you hard wrap code but let comments and docstrings soft-wrap?

Otherwise it's hugely annoying to edit them. Say you remove the first 
three words of a 150 character sentence. Either keep the ugly or rewrap 
manually.


Or are there editors that can do a soft hard wrap while keeping 
indentation and #comment markers intact?




===
Paragraph 1:  65 and 72 cols are US typewriter standard 12 and 10 pt
  respectively. (MSDOS screen, business standard paper, ..)
  And yes, soft wrap does. Check the hardcopy which wraps
  code with lots of long lines.

Paragraph 2:  Comments? I vote no. These are in the code and should
  conform to helping at that location.
  Doc_stuff - I vote yes. For the obvious reason that it
  makes formating the Docs easier AND is to be 'extracted'
  to a separate file for that purpose in the first place.

Paragraph 3:  True

Could you give a short example of what you are referring to in your last 
paragraph?  I showed this to several friends and got several 'views' as 
to what is intended.



I assume you are NOT intending to use third party programs to write code 
in but rather to use Python somehow?


I assume you are intending that the editor add the backslash newline at 
 appropriate places without causing a word or code break when needed 
and simply wrapping with indent without breaking the code the rest of 
the time and doing so in such a fashion that ALL general text editors 
will be able to display code properly as well as be usable in modifying 
code?
Not to mention that the interpreter and/or compiler will still be able 
to use the file.



Steve

--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-11 Thread MRAB

norseman wrote:

Tobias Weber wrote:

Hi,
the guideline (PEP 8) is hard wrap to 7x characters. The reason given 
is that soft wrap makes code illegible.


So what if you hard wrap code but let comments and docstrings soft-wrap?

Otherwise it's hugely annoying to edit them. Say you remove the first 
three words of a 150 character sentence. Either keep the ugly or 
rewrap manually.


Or are there editors that can do a soft hard wrap while keeping 
indentation and #comment markers intact?




===
Paragraph 1:  65 and 72 cols are US typewriter standard 12 and 10 pt
  respectively. (MSDOS screen, business standard paper, ..)
  And yes, soft wrap does. Check the hardcopy which wraps
  code with lots of long lines.

Paragraph 2:  Comments? I vote no. These are in the code and should
  conform to helping at that location.
  Doc_stuff - I vote yes. For the obvious reason that it
  makes formating the Docs easier AND is to be 'extracted'
  to a separate file for that purpose in the first place.

Paragraph 3:  True

Could you give a short example of what you are referring to in your last 
paragraph?  I showed this to several friends and got several 'views' as 
to what is intended.



I think he means something like:

# 65 and 72 cols are US typewriter standard 12 and 10 pt respectively.

when wrapped to 40 gives:

# 65 and 72 cols are US typewriter
# standard 12 and 10 pt respectively.

and when rewrapped to 60 gives:

# 65 and 72 cols are US typewriter standard 12 and 10 pt
# respectively.

Indentation of lines wouldn't be affected, so:

# 65 and 72 cols are US typewriter standard 12 and 10 pt 
respectively.


when wrapped to 40 gives:

# 65 and 72 cols are US
# typewriter standard 12 and 10
# pt respectively.

and when rewrapped to 60 gives:

# 65 and 72 cols are US typewriter standard 12 and
# 10 pt respectively.



I assume you are NOT intending to use third party programs to write code 
in but rather to use Python somehow?


I assume you are intending that the editor add the backslash newline at 
 appropriate places without causing a word or code break when needed and 
simply wrapping with indent without breaking the code the rest of the 
time and doing so in such a fashion that ALL general text editors will 
be able to display code properly as well as be usable in modifying code?
Not to mention that the interpreter and/or compiler will still be able 
to use the file.



--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-11 Thread Simon Brunning
2009/5/10 Tobias Weber t...@gmx.net:
 (still not gonna use software that doesn't let me type # because it's
 alt+3 on a UK layout; having to re-learn or configure that is just sick)

To use Aquamacs with a UK keyboard, you want to select Options, Option
Key, Meta  British. Things just work then.

-- 
Cheers,
Simon B.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-11 Thread Rhodri James

On Mon, 11 May 2009 08:39:48 +0100, Tobias Weber t...@gmx.net wrote:


In article mailman.5400.1242000728.11746.python-l...@python.org,
 Rhodri James rho...@wildebst.demon.co.uk wrote:


What on earth are you talking about?  '#' has its own key on a UK layout


Not on Apple keyboards, and the emacs release in question is Mac only.


My commiserations.  That was a bad design decision on so many levels.

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-11 Thread Arnaud Delobelle
Tobias Weber t...@gmx.net writes:

 In article mailman.5386.1241975816.11746.python-l...@python.org,
  David Robinow drobi...@gmail.com wrote:

 (define-key key-translation-map [?\M-3] #)
 
 
 or, if you prefer, just be sick.

 Thanks, but I don't believe using releases from people who think I jump 
 should through hoops just to make my keyboard work is a good plan for a 
 relaxed future. According to their release notes this was (once) fixed 
 years ago.

No need for editing .emacs.

Click 'Options' on the menu bar, hover down to the 'Option Key ' item,
then select the 'Meta  British' option.  This is IMHO the best option
(if you have a UK keyboard, of course!).  This way, Alt-3 gives you a
'#'.

It would be a shame to abandon Aquamacs just for this, they have made a
lot of efforts to make it integrate well with OSX and I think this is
one of the few hurdles that are left.

-- 
Arnaud
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-10 Thread Steven D'Aprano
On Sun, 10 May 2009 13:41:15 +1200, Lawrence D'Oliveiro wrote:

 If I had to print out all the code and documentation I have to look at,
 I'd need to add another room to my house.


You are allowed to throw it away when you're done with it :)



-- 
Steven
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-10 Thread Scott David Daniels

Steven D'Aprano wrote:

On Sun, 10 May 2009 13:41:15 +1200, Lawrence D'Oliveiro wrote:

If I had to print out all the code and documentation I have to look at,
I'd need to add another room to my house.


You are allowed to throw it away when you're done with it :)


Except here in Portland, where you'd better recycle it. ;)

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-10 Thread David Robinow
On Sun, May 10, 2009 at 3:32 AM, Tobias Weber t...@gmx.net wrote:
 In article m2bpq2ngup@googlemail.com,
  Arnaud Delobelle arno...@googlemail.com wrote:

 A simple Alt-Q will reformat everything nicely.

 Now that's something. Thanks!

 (still not gonna use software that doesn't let me type # because it's
 alt+3 on a UK layout; having to re-learn or configure that is just sick)

 Put the following in your .emacs file:

(define-key key-translation-map [?\M-3] #)


or, if you prefer, just be sick.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-10 Thread Rhodri James

On Sun, 10 May 2009 08:32:23 +0100, Tobias Weber t...@gmx.net wrote:


In article m2bpq2ngup@googlemail.com,
 Arnaud Delobelle arno...@googlemail.com wrote:


A simple Alt-Q will reformat everything nicely.


Now that's something. Thanks!

(still not gonna use software that doesn't let me type # because it's
alt+3 on a UK layout; having to re-learn or configure that is just sick)


What on earth are you talking about?  '#' has its own key on a UK layout
(shared with '~', but you know what I mean), just to the left of the
RETURN key.  Emacs is my editor of choice, and I've never once come
across anything like this.

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Ben Finney
Tobias Weber t...@gmx.net writes:

 Or are there editors that can do a soft hard wrap while keeping 
 indentation and #comment markers intact?

Yes. Both Emacs and Vim will do exactly this when re-wrapping a
paragraph of commented lines, provided they have support for the
language's comment syntax (which, for Python, they do).

-- 
 \“Only the educated are free.” —Epictetus |
  `\   |
_o__)  |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Steven D'Aprano
On Sat, 09 May 2009 07:19:45 -0700, Scott David Daniels wrote:

  So what if you hard wrap code but let comments and docstrings 
  soft-wrap?

 You apparently have caught the soft-/hard- disease spread by several
 software retailers.  There are no such characters as hard break, soft
 break,  hard space,  and soft space.  Check you ASCII or Unicode
 standards if you disagree.  There is a non-breaking space in Unicode,
 but it doesn't mean what you mean.

You say that as if ASCII and Unicode are the only conceivable sets of 
characters.

Even if they are (and they're not), the OP didn't ask about inserting 
hard/soft *characters*. He asked about *actions*: hard-wrapping code and 
soft-wrapping comments. He does that (presumably) by inserting newline 
characters in code where he wants to force a new line, and telling his 
editor to wrap comments according to the editor's own algorithm 
(presumably some variation of the rule if a line extends beyond the 
right-edge of the window, wrap it to the next line in the display, but do 
not insert a newline character). This is not a disease, it is very 
useful when editing unstructured text. Believe it or not, text editors 
are not only useful for editing source code *wink*


[aside]
Personally, I think it is just a little bit sad that in 2009 we still 
write programs using editors which are character-based instead of token-
based and syntax-aware. At least good editors have syntax highlighting. 
Maybe in another 20 years, nobody will care about low-level details like 
the characters used to write code. Only the tokens really matter.
[/aside]


My own opinion is that if the OP is not sharing his code with anyone 
else, he can do whatever he likes. Nevertheless, there is value in 
sticking to the standards that the majority use, and so I tend to stick 
to a line length of 70 characters or less for both code and comments. I'm 
not religious about it though.



-- 
Steven
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Arnaud Delobelle
Tobias Weber t...@gmx.net writes:

 In article k8ydnapzmfvqepjxnz2dnuvz_gqdn...@pdx.net,
  Scott David Daniels scott.dani...@acm.org wrote:

 At least vim and emacs can do so.

 Just tried Aquamacs. Using the defaults it correctly re-wraped 
 docstrings using newlines when inserting, but not when removing words.
 So even with the prime editor hard wrap seems, for writing, inferior to 
 soft wrap.

A simple Alt-Q will reformat everything nicely.

-- 
Arnaud (posting using gnus on Aquamacs)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Ben Finney
Tobias Weber t...@gmx.net writes:

 In article 87zldmcod8@benfinney.id.au,
  Ben Finney ben+pyt...@benfinney.id.au wrote:
 
  Yes. Both Emacs and Vim will do exactly this when re-wrapping a
 
 Thought so. And editors without a learning curve?

A text editor that will be useful in all of your computing is something
worth learning. Instead of needing to re-learn an editor every time you
take up a new text editing task, pick a powerful, customisable editor
and learn it *once*. Either of Emacs or Vim are good choices.

-- 
 \ “The trouble with the world is that the stupid are cocksure and |
  `\ the intelligent are full of doubt.” —Bertrand Russell |
_o__)  |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Lawrence D'Oliveiro
In message towb-ea7906.14423909052...@news.individual.de, Tobias Weber 
wrote:

 the guideline (PEP 8) is hard wrap to 7x characters.

Nowadays I set my maximum line lengths, and the widths of my terminal 
windows to 100 characters. And I'm wondering whether or not to go wider 
still. After all, the screens can take it.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Scott David Daniels

Lawrence D'Oliveiro wrote:
In message towb-ea7906.14423909052...@news.individual.de, Tobias Weber 
wrote:



the guideline (PEP 8) is hard wrap to 7x characters.


Nowadays I set my maximum line lengths, and the widths of my terminal 
windows to 100 characters. And I'm wondering whether or not to go wider 
still. After all, the screens can take it.



But the printers cannot.  And I wind up quietly cursing code writers
who figure the only window I look at is the one they put the code in.
In other words, I have a large enough screen to look at two pages
side-by-side, and somebody decides he wants to use 2/3 of that width.
Think of your reader, not just your operational environment, unless
you are programming on your own and don't care to share.

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Lawrence D'Oliveiro
In message vasdncdmgoq_gzvxnz2dnuvz_vqdn...@pdx.net, Scott David Daniels 
wrote:

 Lawrence D'Oliveiro wrote:

 In message towb-ea7906.14423909052...@news.individual.de, Tobias Weber
 wrote:
 
 the guideline (PEP 8) is hard wrap to 7x characters.
 
 Nowadays I set my maximum line lengths, and the widths of my terminal
 windows to 100 characters. And I'm wondering whether or not to go wider
 still. After all, the screens can take it.
 
 But the printers cannot.

If I had to print out all the code and documentation I have to look at, I'd 
need to add another room to my house.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Lawrence D'Oliveiro
In message gu5bbr$1u...@lust.ihug.co.nz, Lawrence D'Oliveiro wrote:

 In message vasdncdmgoq_gzvxnz2dnuvz_vqdn...@pdx.net, Scott David Daniels
 wrote:
 
 Lawrence D'Oliveiro wrote:

 In message towb-ea7906.14423909052...@news.individual.de, Tobias Weber
 wrote:
 
 the guideline (PEP 8) is hard wrap to 7x characters.
 
 Nowadays I set my maximum line lengths, and the widths of my terminal
 windows to 100 characters. And I'm wondering whether or not to go wider
 still. After all, the screens can take it.
 
 But the printers cannot.
 
 If I had to print out all the code and documentation I have to look at,
 I'd need to add another room to my house.

And yes, the printers most certainly can take it. Back in the days when you 
couldn't even choose different fonts, the most common width for printouts 
was 132 columns.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Scott David Daniels

Tobias Weber wrote:
the guideline (PEP 8) is hard wrap to 7x characters. The reason given is 
that soft wrap makes code illegible.


So what if you hard wrap code but let comments and docstrings soft-wrap?

You apparently have caught the soft-/hard- disease spread by several
software retailers.  There are no such characters as hard break,
soft break,  hard space,  and soft space.  Check you ASCII or
Unicode standards if you disagree.  There is a non-breaking space
in Unicode, but it doesn't mean what you mean.

If you cannot fix everyone else's editors, print drivers, and display
software to have a soft wrap that suits their style, then you are
asking others to bend their workflow to suit your style.  This rule
is not to make the writing or altering of code easier; it is about
making the _reading_ of code easier.  Think of it as a treaty
point, like the no tabs rule -- violating it works fine for any
individual, but following it eases cooperative work.


... Or are there editors that can do a soft hard wrap while
keeping  indentation and #comment markers intact?

At least vim and emacs can do so.  Some other editors redefine
standards in order to make their work easier.

--Scott David Daniels
scott.dani...@acm.org

--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-09 Thread Grant Edwards
On 2009-05-10, Scott David Daniels scott.dani...@acm.org wrote:

 Nowadays I set my maximum line lengths, and the widths of my terminal 
 windows to 100 characters. And I'm wondering whether or not to go wider 
 still. After all, the screens can take it.
 
 But the printers cannot.

Printers?

The people who produce books?

What've they got to do with it?

-- 
Grant

--
http://mail.python.org/mailman/listinfo/python-list