problem with Sorting from Array

Chris Rebert clp2 at rebertia.com
Thu Feb 3 07:59:47 CET 2011


On Wed, Feb 2, 2011 at 10:30 PM, shanti bhushan
<ershantibhushan at gmail.com> wrote:
> Dear All,
>
> funtion "textPosValue " will give me key ,type and pos values from the
> arrays.
> This an embedded application code .
> I want to execute some thing when key ==0 && type ==0 please let me
<snip>
>                if (key ==0 && type ==0)                                 // i want

The logical-AND operator in Python is spelled "and", not "&&" as in
C-like languages.
Also, comments start with a "#", not with "//" (though you probably
already know this and seem to have merely had a momentary lapse).

I can offer no definitive guidance as to where the conditional belongs
due to your code's purpose being rather opaque. I would hazard a guess
that it should go near where you change the values of `key` and `type`
(since the condition depends upon them) and outside of any nested loop
(since you mentioned nothing about repetition).

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list