Forums » Bugs & Problems Search

Style guide New Reply

Author Post
Posts: 6
Registered: Mar 03, 2009

Hi (again!)

I've only just started looking through the example code, and I see a few different coding styles. Not that I want to say ANYTHING bad about the amazing code you guys are writing, and please don't take this as criticism, but it would generally be easier to understand the examples if the coding style were a little more consistent.

e.g. (each entry represents a different file): 1 inputFilename 2 input_filename

and: 1 normalize_distance_matrix() addDrums() <-- these two functions are in the same class

and,(I already mentioned this in my last mail):
1 input_filename_a = sys.argv[1] 2 input_filename_a = sys.argv[-4] 3 inputFilename = sys.argv[2] 4 inputFilename = sys.argv[-2]

An extra note to my last mail about command line args is that sometimes they are handled in main(), and sometimes after 'if name =='

and: 1 if units in ["tatums", "beats", "bars"]: chunks = audiofile.analysis.getattribute(units)

2 if toReverse == 'beats' : chunks = audioFile.analysis.beats elif toReverse == 'segments' : chunks = audioFile.analysis.segments

and: 1 if name == 'main': import sys <--- after 'if name'

2 import sys <--- at top of file

and: 1 import lame, mad, numpy, eyeD3

2 import numpy import sys import time

Anyway, please don't hate me ;) I still have a_lot to learn about python, and I'm just trying to be consistent myself. My hat is off to you guys. Thanks for this amazing service, and I look forward to having some fun with it :)

Cheers, Rich.

Posts: 713
Registered: Sep 08, 2008

ontouser:

I chuckled when I read your post. Indeed our code samples show the disparate programming lineage of the various developers involved in the project. Luckily we have a hardcore python guy on staff now who is establishing a python style guide for the company so we should be producing more consistent and better styled Python code in the future. Cleaning up these code samples seems like a good place for us to start. Thanks for the feedback and your interest in helping us improve our code.

Paul

Posts: 6
Registered: Mar 03, 2009

Hi,

Phew, ok... you don't hate me :)

Shame I didn't see the 'Markdown' bit before I posted, but it was still almost intelligible.

Cheers, Rich.

Reply to this Thread

You must log in to post a reply.