[Tutor] PySide 1.2.2 and Python 3 - "native Qt signal is not callable"

Danny Yoo dyoo at hashcollision.org
Sun Aug 31 04:58:45 CEST 2014


On Sat, Aug 30, 2014 at 7:49 PM, Juan Christian
<juan0christian at gmail.com> wrote:
> Let's see, the print is just "debug", it's not necessary in the program.
>
> 'row[0]' is the first element of the current row. Ex.: row = ['a', 'b', 'c',
> 'd'] - row[0] would be 'a'
>
> 'rates' is a dictionary, 'rates[row[0]]' would update the key row[0] in the
> dict with the 'value'
>
> I think that's it, right?


Close enough.  Let's look again now.

                 print(rates[row[0]] + " / VALUE : " + str(value))
                 rates[row[0]] = value

The print statement here is trying to print the value for a record
that hasn't been entered in yet.  So one way to naively fix this is to
just switch the statements around:

                rates[row[0]] = value
                print(rates[row[0]] + " / VALUE : " + str(value))

But that probably doesn't mean what you want.  Otherwise, you'd be
printing the value _twice_ in your debugging output.  Try it out and
you'll see what I mean.

You probably meant to write:

                 print(row[0] + " / VALUE : " + str(value))
                 rates[row[0]] = value

This is why human understanding is necessary here: it's all too easy
to make a program run, but not make much sense.  Here, there are at
least two ways to "fix" the erroneous situation, but only you can tell
us the right thing to do is.

That's why I asked very emphatically: what do you mean?  :P


(And frankly, you probably don't want the print statement there in the
first place: it's debugging output.  Right?)


More information about the Tutor mailing list