Hello Adam,

Thanks for this comprehensive feedback, I found many of the suggestions in the group as well as the link you sent quite useful in identifying some of the problems in the code.

Needless to say that we could have done a better job and the limited experience in Python definitely shows and I wouldnt deny that. We have promised the customer due diligence on our part so as far as we are concerned we shall do that 100%. Apart from that its also a matter of pride since the team does not want to consider itself as one that left the customer unhappy.

Thanks,
Rajesh.



On 10/11/06, Adam Jones < [EMAIL PROTECTED]> wrote:


Rajesh Narayanan wrote:
> Well the 'accusation' is that the code is unmaintanable. In the world of
> customer-provider relationship, the 'customer is (well in most parts :-) )
> is always right. I agree with you though that
> practicality  beats purity. But the realization that has just dawned upon us
> is that a customer who lives Python, lives in a perfect world :).

Python is not perfect. Anyone who is trying to tell you that is either
misguided[1] or trying to sell you something.

As for solving your problem, is it at all possible to get them to give
you an example or two of what the consider Pythonic? I doubt it,
otherwise you probably would be asking them instead of asking on here.
(that or you did ask them and it wasn't useful enough)

I think a big part of being "Pythonic" is recognizing the existence of
Python's higher-order operators/types/etc and using them
intelligently[2]. For instance, if you were trying to perform an
operation on each element of an array, this is what you would do in
C[3]

for(i=0;i<length(thelist);i++) {
    do_stuff(thelist[i])
}

Although you can write something similar in Python, many of the built
in data types - including all of the built-ins that you could use to
resemble a list - have iterators. The "Pythonic" equivalent of the
above would be:

for item in thelist:
    do_stuff(item)

List comprehensions are also extremely useful, and generally end up
being faster.

String handling is another area where a lot of people trip up. If you
are working with portions of a string and are not using slice operators
you probably should be.

You might get something out of doing a google search on the word
"pythonic". I know I came across a little bit of good reading doing it.

In general though, I want to reinforce PJE's advice in the link I gave
you: expect more out of Python. Be lazy. Don't implement anything
yourself unless you absolutely have to (or the built-in solutions would
be ugly), and unless it turns out to be a nasty hack do what you can to
cheat when you do have to implement something. I would say that
generally the same thing applies to TurboGears.

-Adam

[1] "misguided" can be here defined as operating on false information,
inexperienced enough to know that Python has some rough edges, or total
batshit crazy ... please choose the harshest interpretation that does
not upset you, as that is exactly the one I meant.

[2] "intelligently" is by far the most important word in that sentence.
If the stereotypical "Pythonic" solution does not make sense you
probably don't want to use it.

[3] it has been long enough since I have even seen C code for the
language to legally have me declared dead. Please interpret it as well
as possible.






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to