Raj wrote:
> Hi,
> 
> We just executed a project with Python using TG. The feedback was to
> use more python like programming rather than C style code executed in
> Python. The feedback is from a Python purist and for some reasons we
> cannot solicity his help.
> 
> So we'd like to do is to scrub through the codebase and identify places
> where the codebase needs improvement, both from styling as well as
> design. Is there any website that can provide me with advanced tips
> rather than just tutorials coz thats not of much help.

Googling for "python is not java" may be a good start. Also, here are 2
common C-style smells:

1/ using explicit indexing instead of iteration:

C-smell :
for i in range(len(seq)):
  do_something_with(seq[i])

Pythonic:
for item in seq:

 do_something_with(item)
# or if you need the index too:
for i, item in enumerate(seq):
  do_something_with(i, item)

2/ functions that returns a status code and modify their arguments. The
pythonic way is to have the function return multiple args and raise an
exception if something went wrong


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to