Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!newsfeed-00.mathworks.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: PEP8 79 char max Date: Wed, 31 Jul 2013 16:32:30 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 44 Message-ID: References: <51F6C5F5.5020201@Gmail.com> <51f6e1d8$0$30000$c3e8da3$5496439d@news.astraweb.com> <51F6ED13.5010508@Gmail.com> NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1375288350 25440 64.122.56.22 (31 Jul 2013 16:32:30 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 31 Jul 2013 16:32:30 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:51668 On 2013-07-31, Tim Chase wrote: > On 2013-07-31 07:16, Joshua Landau wrote: >> On 30 July 2013 18:52, Grant Edwards wrote: >>> I also find intializers for tables of data to be much more easily >>> read and maintained if the columns can be aligned. >> >> Why do you have tables in your Python code? For example: if you're writing an assembler, you usually have a table of mnemonics/opcodes/instruction-format/addressing-modes. > I've had occasion to write things like: > > for name, value, description in ( > ("cost", 42, "How much it cost"), > ("status", 3141, "Status code from ISO-3.14159"), > ... > ): > do_something(name, value) > print(description) > > I interpret Grant's statement as wanting the "table" to look like > > for name, value, description in ( > ("cost", 42, "How much it cost"), > ("status", 3141, "Status code from ISO-3.14159"), > ... > ): > do_something(name, value) > print(description) Exactly. When you have more than about 5 columns and 10 rows, having things aligned makes it far, far, easier to maintain. > which does give some modest readability benefits, but at a creation > cost I personally am unwilling to pay. It only gets typed once, it gets read hundreds or thousands of times. Optimize the common case. -- Grant Edwards grant.b.edwards Yow! I am NOT a nut.... at gmail.com