Posting from Google Groups

Many people find reading the comp.lang.python newsgroup / python-list mailing list on Google Groups to be simple and convenient. It is also possible to post messages to the list from there. But please be aware that your message will be read by many people using mail or Usenet clients, not Google Groups. Posts from Google Groups have some problems that may make your post difficult or annoying to read by these other list participants, and all would appreciate it if you would fix them before clicking the Post button.

1. Please remove extra blank ">" lines.

2. Please don't remove attributions.

3. Not all list readers may see your post.

4. Follow accepted mailing list netiquette. These are conventions that all posters should try to follow, they are not specific to Google Groups posters. See for example Three in particular often complained about when ignored are:

Automatic correction

This section is as yet experimental

The following is one way of automatically correcting two of GG's nuisances:

  1. Double spacing quoted blocks
  2. Excessively long lines

Please note that


1. Install the firefox plugin Its all text

2. Save the script below as a python file say ~/ and make it executable. Also adjust the python3 first line to whatever is your executable

   1 #!/usr/bin/env python3
   3 # As far as I know both python2 and 3 work
   4 # Windows/Mac no idea :-)
   6 # A script to drop-in as an editor for firefox addon "Its all text"
   7 # It cleans up two google-group nuisances:
   8 # 1. Useless blank lines
   9 # 2. Excessively long lines
  10 # No efforts at error reporting as stderr is not available in any
  11 # easy way (I know) to firefox (other browsers?)
  12 # To test separately:
  13 # Compose a mail (preferably reply) in GG
  14 # Copy-paste the stuff (maybe with some long lines added without the >)
  15 # Run this script with that filename as argv[1]
  17 from sys import argv
  18 from re import sub
  19 import re
  21 # Clean double spacing
  22 def cleands(s):
  23     # Assumption: ASCII 025 (NAK) never occurs in input
  24     s1 = sub("^> *\n> *$", "\025"  , s , flags=re.M)
  25     s2 = sub("^> *\n"    , ""      , s1, flags=re.M)
  26     s3 = sub("\025\n"    , ">\n"   , s2, flags=re.M)
  27     return s3
  29 # Maximum length that (new) lines should attain
  30 Maxlen = 75
  32 # clean all long lines, s is the whole file/text
  33 def cleanall_ll(s):
  34     lines = (cleanll(l) for l in s.split("\n"))
  35     return "\n".join(lines)
  37 # clean one long line
  38 def cleanll(line):
  39     return ( line if line.startswith(">") else cleanll_rec(line) )
  41 def cleanll_rec(line):
  42     if len(line) <= Maxlen : return line
  43     pos = line.rfind(" ", 0, Maxlen)
  44     if pos == -1 : #Failed due to no spaces
  45         return line
  46     return line[0:pos] + "\n" + cleanll_rec(line[pos+1: ])
  48 def clean(s):
  49     return cleanall_ll(cleands(s))
  51 def main():
  52     with open(argv[1])      as f: s =
  53     with open(argv[1], "w") as f: f.write(clean(s))
  55 if __name__ == '__main__' :
  56     main()

3. In firefox go to the tools → addons → extensions → Its all text preferences and set the editor to ~/ (expanding ~ to your actual home directory)


After the above, in firefox, when editing a text box in google groups a small edit button should appear at bottom right of text box.

Clicking on it does two cleanups:

So the optimal way of using it is

  1. After clicking reply, first click edit to clean-up (a)
  2. Trim what is not relevant to your post
  3. Write your comments at the appropriate place
  4. Click edit again to clean up the long lines (b)
  5. Post!

In short you need do 2 clicks more than what you would otherwise do.

For fresh posts (not replys) you dont need the first click as there is nothing to clean up.


Not really tested on windows

Evidently Its all text only accepts 'executables' for editors. Putting the following into a bat file and pointing Its all text to that seems to work.

pythonw c:\ %1

GoogleGroupsPython (last edited 2014-02-12 22:05:20 by MarcAndreLemburg)

Unable to edit the page? See the FrontPage for instructions.