[BangPypers] PyAutoRun
Senthil Kumaran
orsenthil at gmail.com
Fri Feb 26 12:28:04 CET 2010
On Fri, Feb 26, 2010 at 03:47:15PM +0530, Zubin Mithra wrote:
> Hello,
>
> I have been using python for quite some time; however this is the
> first python project i have worked on.
I see that the script is just a short cut utility, I personally feel opening
the file in the editor and then doing rest is easier for me than say I would
use this script. However if this was some kind of coding exercise, it is good
for you.
>
> The code is hosted at http://github.com/zubin71/PyAutoRun
>
> The code needs re-factoring and feature additions; i have put up a
> TODO list there too. It`d be great if anyone could work on this; i
Some review comments.
in the core.py
---
import os, sys, random
---
This is usually discouraged. better would be write one import in one line.
Also writing one import stmt in a line has the practical advantage that if you
were to use code parsing tools like 2to3, it would work properly.
---
from os import system
---
See if you can use subprocess.
---
EDITOR = "vim"
---
What if I want to use gedit? Would you provide an option?
---
dictionaryCompiled = {'c': 'gcc', 'cpp': 'g++', 'java': 'javac'}
dictionaryInterpreted = {'py': 'python', 'sh': 'bash', 'rb': 'ruby'}
---
globals are usually a sign that your program is incorrect. try to communicate
using args or better yes, create a class and use the methods in that class. And
thisFormat is not used python. Just use smallcase variable name.
---
def openfile(_file):
---
In all places, _file is not required. The exposed variables prefixed by _ are
understood to be private. In your case just use a better variable name fname.
---
commandOPEN = EDITOR + " " + _file #make command line statement for opening a file
---
It could be COMMANDOPEN.
--
Senthil
American by birth; Texan by the grace of God.
More information about the BangPypers
mailing list