Murtan 317 Practically a Master Poster

do you still have the variable player1 in main? it will hide the new function.

Murtan 317 Practically a Master Poster

Wow, deja vu, but better problem description.

The last word won't be followed by a space...

add another if (counter > longest_word) outside the for loop to handle the last word.

or alternatively...you could just add a space to the end of the string to make sure that there is one.

Murtan 317 Practically a Master Poster

The only obvious thing I see is that it doesn't try to save the length of the last word, it would appear to work for everything else.

The last word in the sentence won't be followed by a space, it will be followed by the end of the string.

Add another if (counter > longest_word) outside the for loop to handle the last word.

If this wasn't your problem, be more specific: "When I input ___ I expected ___, but I'm seeing ___" type of description for the problem. Clear and concise, making it easy for us to help you works best.

Murtan 317 Practically a Master Poster

Lets try to describe the problem better...

Is the problem:
a) search the directory for a file name
b) search a specific file for string data
c) search all of the files in a directory for string data
d) search all of the files in a directory tree for string data
e) something else

Be clear and concise in your problem description.

We also tend to be a lot more helpful if you show that you're trying to do this yourself. Include a list of the steps you would follow if you were trying to solve the problem manually. We can discuss the list and help you write the code to make the steps happen.

Murtan 317 Practically a Master Poster

I'd be much more willing to look for the problem if you listed the line number the compiler complained about. Generally giving us all of the information you have about the problem is a good idea.

Murtan 317 Practically a Master Poster

as far as I can tell, you're only "drawing" the sides of the square, you didn't do the top or bottom yet...

In the sides code, the internal loop (for the spaces) is destructively decrementing your limit. (I'm referring to the s-- that limits your loop.) You should either reset s (to sides - 2) just before the loop starts every time, or use another variable to count up to s instead of destroying it.

As an alternative, you could build a string up to be the "* *" with as many spaces as you require and then just output the string the appropriate number of times.

Murtan 317 Practically a Master Poster

I'm presuming that x is the number of array entries you filled. A more descriptive name would be more appropriate.

line 15 in your code would be executed for every pass of the loop.

If the first one doesn't match, then line 15 assumes you can't find it and terminates the loop.

You need to move the line 15 test outside the for loop and remove the break.

You will also need to set look to false before the for loop starts.

Murtan 317 Practically a Master Poster

It looks to me like the status function only writes the prompts that precede an input. The test for status in the code jonsca posted causes the input to be skipped so that might fix your problem.

(If not, try entering a value where the program appears to be paused -- I think its still asking for an amount to withdraw even though it shouldn't.)

Another question regarding implementation...is the $25 savings item really being handled like it is intended?

For example if my account starts with (or if it starts at $0 I deposit) $60. The balance is > $25 so it is active. Then I can withdraw $59, leaving $1 and making the account inactive. If the intent is to preserve a $25 minimum balance, shouldn't the withdraw prevent me from removing more than $35 to preserve the $25? (That's how my credit union works, the last $25 in my savings account cannot be removed at all unless I'm closing out the account.)

Murtan 317 Practically a Master Poster

Work the problem in steps.

I see the steps as something like:

Prompt the user for where to put their symbol

Accept the user input

Validate that they entered something acceptable and that the location they asked for is available

Set the location to their character

You would then probably redraw the board.

This would be a good point to check for a winner (if that's something you need to do).

If there are still available spaces on the board, you would repeat the above for the 'other' player.

If you see a different set of steps, go ahead and use yours, but a brief outline like this for how you expect the program to work does wonders for keeping yourself aligned.

In any case, pick a step, write it and test it. If it doesn't work, try to figure it out. If you can't figure it out, post that part of your code, tell us what you want it to do, what it does now and the other things you tried.

For projects like these (that we all presume are homework) you get much better help when you demonstrate your work.

Murtan 317 Practically a Master Poster

You generally call methods on an object instance. (This is why I was talking about 'keeping' a reference to the child windows you created and 'knowing' which child was the current one.) You would ask the current form to save.

// If you setup using a framework and setup your main window to support MDI
// you might be able to use this.ActiveMdiChild
// but it will be of type Form and not frmEditor
frmEditor currentEditor = this.activeEditor.
if (currentEditor != null)
    currentEditor.Method(arguments)
Murtan 317 Practically a Master Poster

It is BAD FORM to bring a thread that is over 3 years old back to life.

If you have a problem, you might follow the suggestions in the thread to get started. Once you've made some progress, start your own thread.

For homework or assignment type problems, we expect you to do most of the work. We much prefer that you post your code (or a part of it) with comments and questions like "I expected it to do ___ but it is doing ___" or "I tried __ and __ but can't seem to get it to do ___"

Demonstrate that you're putting effort in and the level of help you get will improve significantly.

Murtan 317 Practically a Master Poster

I was working on a reply similar to Narue's but she says it so much better I threw mine away.

But she's right.

Generally the rule is first, make it work, then if necessary make it work fast.

This isn't a license to do obviously stupid things, but if you've made a reasonable attempt at algorithm selection, you're not likely to have problems.

As an example that runs counter to what you're talking about here, I once sped up a section of code by adding more methods and data. I only did it after profiling the code and identifying an area where we were spending too much time. We examined what the code was actually doing and added a new mechanism that allowed us to use a MUCH more efficient algorithm in that section. The point being that the optimization was not made until the code was working and demonstrated to be slow.

Murtan 317 Practically a Master Poster

Please use code tags so we get indenting and line numbers

[code=c++] // Your code here

[/code]

and if you're wanting help with compile errors, maybe you could post the error message?

Murtan 317 Practically a Master Poster

For a multiple form interface, you will need to keep a list of all of the open forms and keep the list current when forms are closed or opened. You will also need a method to reference the 'current form', the one the user is currently interacting with.

When the user clicks save, you should save the data from the current form. (You might consider adding a 'save all' button that would iterate all of the forms saving each of them.) It also might be beneficial to have a 'dirty' flag that would let you know if the form had any changes to save. You could set the dirty flag any time a change is made to the text field.

Based on your described implementation, I think I would be tempted put the serialization in the child form. The main form would only call a method to tell the child it was time to save and the child would take care of getting it done.

Murtan 317 Practically a Master Poster

That too...(too much Python -- you don't have to have one)

Murtan 317 Practically a Master Poster

Should your turtle support a pen up / pen down setting?

Should your turtle support a pen color?

It should be straight-forward to write the 'forward' code...

You have a current location and a direction and a distance.

for each step in the distance:
   If the pen is down:
      set the current location to the current pen color
   advance the current location to the next location based on the direction

Your proposed 'set direction' method should probably take a degrees (like turn does) but instead of turning relatively, it should do an absolute turn.

Murtan 317 Practically a Master Poster

I tried to read your code to understand your algorithm, but I didn't recognize it, and the limited commenting you provided didn't make it much clearer.

If you run the program with the sample from the link, do you get the same output?

What other test data did you provide to the program?

Did it appear to produce the correct output?

For the input line "apple bagpipe" the process should be something like this:
Ib01 (bapple)
Cg03 (bagple)
Ci05 (bagpie)
Ip06 (bagpipe)
So the output should be:
Ib01Cg03Ci05Ip06E

Or is this more minimal?
Ib01 (bapple)
Ig03 (bagpple)
Ii05 (bagpiple)
Dl07 (bagpipe)
Ib01Ig03Ii05Dl07E

What output does your program produce?

Murtan 317 Practically a Master Poster

This code will not compile because I am trying to assign a myTemplateClass <int> pointer or myTemplateClass <char> pointer to myTemplateClass pointer.


Can we declare a pointer array that can hold myTemplateClass pointer of any type?

Using void pointer will not help much, since it needs a lot of type casting that may introduce bugs. Also it calls for type tracking of each object, which is nasty.

The only way I can think of to be able to store untyped or generic pointer to either template instance would be to have the template class inherit from a base class the defines all of the operations that you might need to perform on the instances of the template. You could then declare your array to be an array of pointers to the base class and any template instance would satisfy the pointer.

Another approach I can think of is to declare two arrays of pointers, one to myTemplateClass<int> and one to myTemplateClass<char> , both of size 10. If you pre-initialized both arrays to NULL values, you could look at either one first, if the value is NULL, the data item is of the other type.

A third approach might be to have a structure that contains the data type and a union of pointers to the possible implementations. You could then have an array of those.

Both of the last two cases require you to keep re-evaluating the type and handling the pointers in a type-safe …

Murtan 317 Practically a Master Poster

We like to help people who appear to at least be attempting to help themselves.

I suspect line 7 won't even compile.

What is the code supposed to do?

What does it do now?

Murtan 317 Practically a Master Poster

Either the record doesn't exist (the dfSicilNo.Text does not exist) or if the record does exist, the field is null.

You should be able to ask the query how many rows (records) it returned (if it is zero, then the record wasn't found).

If there was a row returned, you can use the IsDBNull test from your previous post to make sure that there is data before you try to extract it.

Murtan 317 Practically a Master Poster

I've never actually done it for a website, so you may want to take this with a grain of salt.

The concept is that as a user is added to the 'database' of users, you generate a random 'validation value' that is also stored with the user. You then generate an SMTP messsage (assuming your web host will let you) which sends the user's registered email address a message which identifies the user that is registering and includes a link to another page on your website. The link includes at least 2 pieces of information, one should be enough to 'find' the user in the database again, the second is the previously randomly generated validation value.

The web page that you link to will look at the parameter data, find the user record and confirm that the validation string matches. If it does, someone who can read messages sent to that email address agreed that the registration was valid, so you mark the record as having a valid email address.

Is that what you were looking for or did you want something more specific?

Murtan 317 Practically a Master Poster

I didn't download or open your project (FYI)

I believe that your compiler error on line 18 is related to you attempting to set a member variable in a class scope, and because the thing you are setting it to (if it even resolves) is a property of an object instance that you reference through the class name.

I believe there are a couple of 'normal' ways to access data that will be updated in child forms. One way would be to pass a communication structure (that the parent owns or also references) for the child form to update (as appropriate -- usually when the user clicks OK). A second way would be for the parent form to keep the reference to the child form (from when it creates the child form) and use that reference to access the child forms data.

In your project example, I would probably have the parent form keep a reference to the open editor frame.

NOTE: You don't want to make the private string serializeme and initialize it from the child frame. It would only get the initial value. You need to ask the editor frame for the current contents when the save strip tool menu item is selected. When the open strip tool menu item is selected, you need to make the editor frame (if it does not already exist) and then tell it to update its contents from what you read. The current implementation where it sets the …

Murtan 317 Practically a Master Poster

I would also have leaned toward re-shuffling for each set of random words. Just as long as you don't re-read the words from the file, you've saved most of the work.

You could also use choice() instead of shuffling, but you'd have to protect against selecting the same word more than once in a set.

Murtan 317 Practically a Master Poster

Now we're getting into scope a bit (and its a big topic) but class-level variables only exist once, regardless of the number of instances of the class.

Based on your example, where you want something to persist, it could be a regular member of a class instance and the form could keep that instance around as long as the form was open, it wouldn't have to be a class-level data item. Depending on the data you want to persist, the form could just have the data instead of another class (forms are usually classes too) if that would be more convenient.

class1 and class2 normally don't have any idea that the other class exists unless they need to use the class for something. That is normally a GOOD thing. It encourages and promotes modularity in the code.

If it was necessary, class2 could access the string inside class1 if the string was declared as a public member of the class. Then class2 could reference the string via something like class1::class1string . I would personally however tend to discourage it. If you have an example where you think it might be appropriate, describe it and we'll evaluate whether or not that's a valid application and discuss alternatives.

Murtan 317 Practically a Master Poster

Given your input data (14 grades, one of which was an A)
I would have expected 3 * for A

percent = 100 / 14; // 7 in integer math
Acent = percent * a / 2; // 3 in integer math

Do the other grades display the number of stars you expect?

Question: What's the setw(3) on line 50 supposed to do?

Arbitrary personal style comment:
I personally don't like artificially large loop variable names, and I don't like loops just to loop. For the loop starting on line 39 I would have used something like "gradeidx" instead of "loopcounter". The name has more meaning and is shorter. I wouldn't loop a constant number of times to output spaces...just output the spaces. For the inner loop where you use "asteriskcounter" I would have used something like "ii".

So just to demonstrate the difference:

// loop for each grade
    for (int gradeidx = 0; gradeidx < 6; gradeidx++)
    {
        cout<<"     ";
        // loop to output each asterisk
        for (int ii = 0; ii < array[gradeidx]; ii++)
        {
            cout << "*";
        }
        // print the grade after the asterisks
        cout << "   GRADE " << array2[gradeidx] << endl;
    cout<<endl;
    }
Murtan 317 Practically a Master Poster

Yes that would be a valid example.

Another example would be a 'person' class. Each person has attributes: name, address, phone number, birthday, ...

But any two instances of 'person' are different.

Murtan 317 Practically a Master Poster

The %d in print("wait %d seconds ..." % sec) will be replaced with the numeric value of sec.

I didn't see the %s, but it is used for string values.

@Gribouillis
Shouldn't line 39 test start + 3 against the length of the list?
We're going to be referencing array elements that high.

Murtan 317 Practically a Master Poster

You're going to have to save the operands that you show the quiz taker so that you can actually perform the math to see if they give you the right answer.

Right now, in CheckAnswer, you re-generate two operands and add them together. If the user happens to have entered what the two new random number added up to, the answer is correct.

Seems like a really hard way to take a test, having the problem you're supposed to be answering hidden.

Murtan 317 Practically a Master Poster

I apparently wrote this while Ryshad was replying. He covers most of it in a more elegant fashion, but I'll post it anyway.

Local variables work like you mentioned your i did in VBA. If you declare it in a function, it goes out of scope when the function ends and is no longer available.

In C# as long as someone still has a reference to an object (or list or other collection of objects) the objects continue to persist.

If the form references a car, the form can continue to refer to that same car as long as the form exists. (Even if the user is not interacting with the form at the time.)

Regarding your form and button question, as long as the two components reference i in the same way relative to the form, they would be working with the same value.

Yes, the process of extracting data from an object in memory and writing it to an output (sometimes a file, but could be something else) is what serialization is.

The "objects can hold multiple values" is somewhat incorrect. I think what you're confused with is that there may be more than one instance of an object.

If Car is a class, then Car myCar = new Car(); declares an instance of a car that I called "myCar". I could then additionally declare Car yourCar = new Car(); . Than made 2 different, but similar 'cars'. Each car has …

Murtan 317 Practically a Master Poster

Well, ignoring that your input doesn't do much to protect the user from themselves (for example, enter "fred" when it asks for the account number and see what happens)...

Do you know in advance (or can you ask) how many they want to enter?

If you could, you could wrap the input and output in a loop. Something like the following where numberToEnter is an integer that was set prior to the loop:

BankAccount aBank(0, 0, 0);
		for (int acctindex = 0; acctindex < numberToEnter; acctindex++)
		{
			cin>>aBank;
			cout<< aBank;
			aBank.interest();
		}

That re-uses the aBank instance so at the end, you still only have one instance, but you have filled it and output from it multiple times.

Murtan 317 Practically a Master Poster

The previous posters point was that you have an IF statement on line 17...

an if is either true or false...

The 'true' clause has a return on line 19 and the 'false' clause has a return on line 23...

So in either case, the function has returned before you ever get to line 25.

There is also a lot of risk in the code as you have it written. The test on line 27 (and the related test on line 31) seem to imply that the left or right pointer could be NULL. But you have referenced the left and right pointer before the test. Based on the way you have written balanced() that would seem to be an inappropriate thing to be passing around.

Murtan 317 Practically a Master Poster

The error you were reporting was based in your original code:

if letters[x] == ' ':
        y = 0
        message_number.append(y)
        x = x+1
    if letters[x] == 'A' or 'a':
        y = 1
        message_number.append(y)
        x = x+1
    if letters[x] == 'B' or 'b':
        y = 2
        message_number.append(y)
        x = x+1

The first if test is ok, but the second test and all additional tests would always be true because they are improperly formed. What you intended to test needed to be written like this:

if letters[x] == ' ':
        y = 0
        message_number.append(y)
        x = x+1
    if letters[x] == 'A' or letters[x] == 'a':
        y = 1
        message_number.append(y)
        x = x+1
    if letters[x] == 'B' or letters[x] == 'b':
        y = 2
        message_number.append(y)
        x = x+1

But either of the two examples you were given would be a much better solution. Just wanted to make sure you understood why what you had didn't work even if it was a 'brute force' solution.

Murtan 317 Practically a Master Poster

Your problem is inside the while loop.

while (whileIter != tmpCsvFile.end())
		{
		      whileIter++;
		if (fileName == (whileIter->fileName).c_str())
			break;
			
		}

You have advanced the iterator (possibly to the end) before you try to test the filename. Put the fileName test (with the break) before the iterator advancement.

Murtan 317 Practically a Master Poster

If the parent process doesn't have to wait, why does it care who finishes first.

If at least one child process needs to finish, then you have to wait.

Murtan 317 Practically a Master Poster

Please use code tags when posting code

You will need to re-input the health inside the loop so that it will ask the user for the health again. I suspect the current version outputs the 'health status' waits for enter and then outputs the same status again.

Murtan 317 Practically a Master Poster

I'm not sure what your problem is, when I compile and run it:

start
Caught One! Ex. #: 1
Caught One! Ex. #: 2
Caught a string: Value is zero
Caught One! Ex. #: 3
end

Murtan 317 Practically a Master Poster

That looks like it ought to work.

The program is counting the characters in the word say "daniweb" and also counting the enter as it is also a character before the EOF.

if you entered "daniweb" ctrl+d enter, it should count 7.

Murtan 317 Practically a Master Poster

For the most part in c++, a class is almost the same as a struct. The key difference is that members in a struct default to public, in a class they default to private. You made all of the members of your class public so it shouldn't really matter.

Your list handling needs some work though. In your code, start is a tree and current and temp are also trees (that are initialized to be a copy of start).

huffman_tree start;
start._char = letterstat[0];
start.count = numberstat[0];
 
huffman_tree current = start;
huffman_tree temp = start;

I think the code should be something like:

huffman_tree * start = new huffman_tree;

start->_char = letterstat[0];
start->count = numberstat[0];
start->next = NULL;
 
huffman_tree * current = start;
huffman_tree * temp = start;

In this case current and temp are pointers to the real start node and not just copies of it.

And you need to be EXTRA careful to NEVER assign to start so you can get back to the head of the list.

Hope that helps some, ask questions if I've left you confused.

Murtan 317 Practically a Master Poster

Why not just 'add' the records you want in main, after you construct the list?

int main()
{
    List test;

    test.InsertEmployee("Michael bay",1234,"Design");
    test.InsertEmployee("Enrique",5678,"Production");
    test.InsertEmployee("Fernando ",9012,"Management");
   
    test.DisplayList();
    getch();
    return 0;
}

Note that DisplayList() as written is broken and will only display one record.

I think that InsertEmployee() will work, though it could be simplified a little.

An alternative to the above hard-coded calls to InsertEmployee would be to get the data to add from the array you built, but you're going to have to call InsertEmployee for each of the data items anyway.

Murtan 317 Practically a Master Poster

I can't find the examples right now, but I recall modifying the setup.py to perform a search for some DLLs and using the path I found in the data section.

so instead of the constant string 'msvcr71.dll' you would use a string variable which contains the full path (as built by the search code).

Murtan 317 Practically a Master Poster

I don't see where your enqueue function sets the next and prev members of the node.

When the queue is empty, front and rear should both be NULL.

When you add the first node, front and rear should point to the new node and its next and prev should be NULL.

When you add the second node, the next from the first node should point to the new node and the queue's rear should point to the new node. If you're going to keep the list doubly linked (with both next and prev pointers) the prev pointer for the new node should point to the previously added node.

Then when you 'dequeue' the first node, the front pointer can be set to the 'next' pointer from the node you are removing.

I'm not sure I'm being clear, but the point is that as written, your first node never gets a pointer to the next node (which is what forms the linked list). So there is no 'link' to the next node when you go to remove it.

Hope that helps some, if not, ask for more details and I'll try to explain it better.

Murtan 317 Practically a Master Poster

We like to help those that show some effort, especially when it appears to be an assignment.

Show us what you've tried. Tell us what it does and what you expected it to do and we can help you make the two match up better.

(I wouldn't be surprised to find an example program kicking around here somewhere...did you do a search before you started a topic?)

Murtan 317 Practically a Master Poster

Generally, I like it. (You're right, a GUI would help a lot to follow what's going on. )

Just a couple of nit-picky items:

I don't think it is good form to have the Tank's __init__ method prompt the user for a tank name. I'd rather see the prompt in createTanks() and have it passed to the Tank's __init__

I have a small issue with the tank's setter methods, they don't 'SET' they modify, making the name misleading. It works fine for this application, but from the name, I would have expected set_XPos(5) to set the Tank's X coordinate to 5, and not for it to move the tank 5 positions to the right.

Murtan 317 Practically a Master Poster

I think the forcibly stopped comes from the reader application reading one line and exiting.

Can you put the read into a loop of some form?

If you're going to write to the stream more than once, you should probably read more than once.

You'll probably want to add detection for the stream closing to the reader after you start the loop.

And the read loop should block somewhere, either for the stream to be ready or for a time period. You don't want it running in a tight loop burning cpu cycles without a purpose.

Murtan 317 Practically a Master Poster

The code you posted wouldn't even compile, let alone run.

Please be specific in the problem you are having.

I think the following is close to what you wanted, but it uses global variables which have their own problems:

import Tkinter as tk

root = tk.Tk()
root.title('background image')

def qwerty():
    button2.destroy()
    
#def qwerty():
image1 = tk.PhotoImage(file="Black.gif")

w = image1.width()
h = image1.height()
#panel1.image = image1
root.geometry("%dx%d+0+0" % (w, h))

panel1 = tk.Label(root, image=image1)
panel1.pack(side='top', fill='both', expand='yes')

button2 = tk.Button(panel1, text='Click here to continue', command = qwerty)
button2.pack(side='bottom')

root.mainloop()
Murtan 317 Practically a Master Poster

It looks like it compiled, so the symbol was defined enough for the compiler to recognize them.

The link process is where the actual executable is built. The linker needs to match up the symbol that your main calls with the actual implementation.

You should probably add the pcsfile.cpp to the g++ command line so that it will compile and the linker will look there for symbol definitions.

There are other ways to do it, but that looks the easiest based on your description.

Murtan 317 Practically a Master Poster

Not surprisingly, but your program is doing what you told it to:

// Wait here for the user to enter a message
gets (msg);
      
while (msg != "q")
{
      /* Write out message. */
      if (write(sock, msg, sizeof(msg)) < 0)
         pdie("Writing on stream socket");
      
      /* Prepare buffer and read from it. */
      bzero(buf, sizeof(buf));
      if (read(sock, buf, BUFFER_SIZE) < 0)
         pdie("Reading stream message");
      
      printf("User %d says: %s\n", name, buf);

// Wait here for the user to enter a message
gets(msg);      
}

If you're wanting the client to be both waiting for user input and watching for messages from the server (other client) you will need to implement some form of multi-threading.

One implementation might have a thread that supports the socket and the main display of the chat. (It would add lines to the window as they were received or sent.) Another thread would support the user input, it would wait for the user to enter some data (without blocking the other thread) and then send the message the user entered to the other thread for sending to the server and adding to the chat window.

As an alternative to 'actual' multi-threading, you might be able to do something with a 'main loop' that would check for user input and check for socket data repeatedly. Something like the following:

loop forever
    if there is user input data available:
        if the user input is an 'enter':
            if the input buffer contains 'q':
                break the loop
            send the …
JimD C++ Newb commented: Multi-threading idea sounds great! +1
Murtan 317 Practically a Master Poster

So what you really want is a verification that a specific record (license) exists and you would never want anyone to be able to list or add records.

I'm not sure what resources you have available, but you could implement something like that through web service or a web page. The program would submit the license information and the service would confirm or deny the license.

You might also need to take steps to prevent someone from writing a program to attempt to test for all possible licenses. You might also want to work in a verification that the service that replied was the actual service and not a proxy that always responded with "that's a good license".

The topic is now closer to secure verification of credentials. Similar to the way users authenticate to a network. You might find more commentary and/or examples of how others are doing it if you search under that topic.

Murtan 317 Practically a Master Poster

If the coordinates were tuple (instead of lists) python would compare the values correctly:

a = [(1,2),(2,0)]
b = (2,0)
aa = a[1]
# now aa == b returns True

#alternatively, though probably slightly less efficient, you could convert the coordinates to tuples at the point of comparison
# tuple(aa) == tuple(b) would return True in the first example code.
Murtan 317 Practically a Master Poster

You're having an entity vs value comparison issue:

a = [[1,2],[2,0]]
b = [2,0]
aa = a[1]
# at this point, b = [2,0] and aa = [2,0]
# but aa == b returns False

# aa[0] == b[0] returns True
# aa[1] == b[1] returns True

Python is comparing the list entities and not the list values.

sneekula commented: Very good point! +6