what is wrong with my code?
Pyenos
pyenos at pyenos.org
Wed Dec 20 19:13:41 EST 2006
"Calvin Spealman" <ironfroggy at gmail.com> writes:
> It is hard to determine what is wrong with your code without you
> telling anyone why it is you believe something is wrong with it. Did
> you get an exception? Did it simply not do what it was expected to do?
> There seems to be some apparent indenting problems, but maybe that is
> just from pushing it through the e-mail. I see some general stylistic
> problems as well, but without know what you are actually asking, I
> won't know what questions to answer. "What is wrong with my code?" is
> a container of many many smaller questions, and you need to focus your
> questions better.
>
> On 21 Dec 2006 09:16:58 +1100, Pyenos <pyenos at pyenos.org> wrote:
> > import cPickle, shelve
> >
> > could someone tell me what things are wrong with my code?
> >
> > class progress:
> >
> > PROGRESS_TABLE_ACTIONS=["new","remove","modify"]
> > DEFAULT_PROGRESS_DATA_FILE="progress_data"
> > PROGRESS_OUTCOMES=["pass", "fail"]
> >
> >
> > def unpickleProgressTable(pickled_progress_data_file):
> >
> > return unpickled_progress_table
> >
> > def pickleProgressTable(progress_table_to_pickle):
> >
> > return pickled_progress_data_file
> >
> > # Of course, you get progress_table is unpickled progress table.
> > def progressTable(progress_table, action, task, pid=len(progress_table), outcome=PROGRESS_OUTCOMES[1]):
> > pid_column_list=progress_table[0]
> > task_column_list=progress_table[1]
> > outcome_column_list=progress_table[2]
> >
> > # But a task must also come with an outcome!
> > def newEntry(new_task, new_outcome):
> > new_pid=len(task_column_list)
> >
> > pid_column_list.extend(new_pid)
> > task_column_list.extend(new_task)
> > outcome_column_list.extend(new_outcome)
> >
> > def removeEntry(pid_to_remove, task_to_remove):
> >
> > if pid_column_list.index(pid_to_remove)==task_column_list.index(task_to_remove):
> > # Must remove all columns for that task
> > index_for_removal=pid_column_list.index(pid_to_remove)
> >
> > pid_column_list.remove(index_for_removal)
> > task_column_list.remove(index_for_removal)
> > outcome_column_list.remove(index_for_removal)
> >
> > # Default action is to modify to pass
> > def modifyEntry(pid_to_modify, outcome_to_modify=PROGRESS_OUTCOMES[0]):
> > index_for_modifying=pid_column_list.index(pid_to_modify)
> >
> > # Modify the outcome
> > outcome_column_list[index_for_modifying]=outcome_to_modify
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
>
> --
> Read my blog! I depend on your acceptance of my opinion! I am interesting!
> http://ironfroggy-code.blogspot.com/
it says that progress_table is not defined. i don't know why.
More information about the Python-list
mailing list