Question on Joining of list

ptn tn.pablo at gmail.com
Fri Jul 18 09:42:07 EDT 2008


On Jul 18, 5:40 am, SUBHABRATA <subhabrata.i... at hotmail.com> wrote:
> Hi Peter,Peter Otten wrote:
> > SUBHABRATA wrote:
>
> > > Thanx Peter,
> > > I would change my variables next time I would post.
>
> > No, you should use meaningful variable names when you write your code no
> > matter whether you plan to post it or not.
>
> Good You are teaching me something good in life. Thanx.
>
> > > And obviously,
> > > thanx for your solution. I am reviewing it, I was also trying out some
> > > solutions.
>
> > You misunderstood. I did not modify your code other than changing the
> > variable names. My hope was that with this modification any errors sprang
> > to you eye...
>
> I was seeing that.
> I am almost near the solution. You can also try some hands if you
> feel.
> Best Regards,
> Subhabrata.
>
>
>
> > Peter
>
>

A couple more things on variable naming and coding style:

- You used "a{digit}" to name variables of different types (a4 was an
int, a2 was a list and the rest were strings). Remember C, where i, j,
k are indices, p, q, r are pointers, s, t are strings and x, y, z are
integers. For unimportant variables, you can skip long descriptive
names, so long you don't use a confusing one.

- You violated your own naming conventions. Why did you choose to use
s to name that last string? Use descriptive names and stick to your
own style.

- You use whitespace weirdly (like in a4>-1 or a4=a3.find).

Try reading PEP8 (http://www.python.org/dev/peps/pep-0008/), the Style
Guide for Python Code.

As for your code, you need to find where it is that missing_word and
first_char are being updated, and assign to s before that happens.



More information about the Python-list mailing list