PEP8 79 char max

Neil Cerutti neilc at norwich.edu
Wed Jul 31 21:25:09 CEST 2013


On 2013-07-31, Grant Edwards <invalid at invalid.invalid> wrote:
> On 2013-07-31, Neil Cerutti <neilc at norwich.edu> wrote:
>> On 2013-07-31, Grant Edwards <invalid at invalid.invalid> wrote:
>>> On 2013-07-31, Neil Cerutti <neilc at norwich.edu> wrote:
>>>> Besides, after studying The Pragmatic Programmer I removed
>>>> nearly all the tables from my code and reference them (usually
>>>> with csv module) instead.
>>>
>>> I don't understand.  That just moves them to a different file
>>> -- doesn't it?  You've still got to deal with editing a large
>>> table of data (for example when I want to add instructions to
>>> your assembler).
>>
>> Yes, but it is much easier to manipulate and view. I often still
>> edit the tables with Vim, but when I just want to view them I can
>> open them with Excel and get a very attractive display or
>> printout with minimal effort.
>
> If you're good at Excel.  I use a spreadsheet at most a few times a
> year, and it has been many years since I've used Excel.  I find that
> doing _anything_ with Excel generally involves at least an hour of
> hairpulling and swearing.  Libreoffice isn't much better.
>
>> If it turns out I need to convert the table to some new format,
>> tools are abundant.
>
> True.
>
>> A couple of big wins:
>>
>> It turned out later that some other entity needed the same
>> data.
>
> It would save the two seconds it takes to extract the lines
> from the Python file.

...assuming I'm not creating a maintenance problem by duplicating
the table. Most likely you would end up externalizing the table
at that point, right?

>> It has allowed me to add functionality to my program without
>> even editing the program.
>
> Now you're playing with semantics.  If I have a bunch of lines
> containing values separated by commas, and I'm editting them,
> then it makes no difference to me which file they're in -- I'm
> still adding functionality be editing a table of data.

The separation of data and program is more distinct in my
version, but you're right, of course. An internal representation
in addition has the advantage of being able to directly use
Python identifiers and expressions, too. But if you take
advantage of those features when the time comes to externalize
your data it's more work.

The only cost you pay more than what I've already spent at that
point is whatever time you spent creating the non-external
version to begin with.

-- 
Neil Cerutti



More information about the Python-list mailing list