My patch (attached) accepts > > import (os, sys) > from sys import (stdin, stdout, stderr) > import (os) > from sys import (*) > > but rejects > > from (sys) import stdin > import (os), (sys) > import (os,) > > Should any of those be allowed? Anything that I missed? Others have already mentioned that "from sys import xxx, xxx, xxx" is the case that badly needs line wrapping. I would, however, like to suggest that (if it's easy to do) you allow a trailing comma when parenthesees are used. Of course this looks silly: from mymodule import (xxx, xxx, xxx, xxx,) But in the most extreme case, like this: from myBigModule import ( xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, xxxxxxxx, ) it's awefully nice on cut-and-paste to allow the trailing comma. But the most important reason for doing so is that Python already allows (and disregards) an extra trailing comma in similar lists: >>> [1,2,3,] [1, 2, 3] >>> {1:1,2:2,3:3,} {1: 1, 2: 2, 3: 3} >>> def func(a,b,c,): ... print a, b, c ... >>> func(1,2,3) 1 2 3 >>> (1,2,3,) (1, 2, 3) -- Michael Chermside PS: The length-one-tuple is a special case (and a bit of a wart) in that it MANDATES the use of the trailing comma. But that's got nothing to do with the basic principle.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4