Re: answers.py v0.0.1 - source

2006-12-28 Thread Pyenos
rn 4 else: return 1 def start(self): storage.load() level=1 while 1: if level==0: Console.Menu.Level0().do() if level==1: level=Console.Menu.Level1().do() if level==2: level=Console.Menu.Level2().do() if level==3: level=Console.Menu.Level3().do() if level==4: level=Console.Menu.Level4().do() def start(self):Console.Menu().start() if __name__=="__main__": Console().start() -- Logan Lee aka Pyenos -- http://mail.python.org/mailman/listinfo/python-list

answers.py v0.0.1 - source

2006-12-28 Thread Pyenos
#!/usr/bin/python # answers.py --- A simple answer bot # Copyright (C) 2006 Logan Lee # # MESSAGE: # # This program is a simple text-console program #+that asks for a problem and its solution then #+persists the problem-solution dictionary to

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: > Thanks for clarifying the definitions of nested class and > subclass. However, it did not solve my original problem, and I have > redefined my question: > > class Class1: > class Class2: > class Class3: >

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
Thanks for clarifying the definitions of nested class and subclass. However, it did not solve my original problem, and I have redefined my question: class Class1: class Class2: class Class3: def __init__(self): self.var="var" class Class4:

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
class Class1: class Class2(Class1): variable="variable" class Class3(Class2): print Class1().Class2().variable #problem Also, why is this wrong? -- http://mail.python.org/mailman/listinfo/python-list

I'm having trouble understanding scope of a variable in a subclass

2006-12-27 Thread Pyenos
Approach 1: class Class1: class Class2: def __init__(self):self.variable="variable" class Class3: def method():print Class1().Class2().variable #problem Approach 1.1: class Class1: class Class2:

can't instantiate following inner class

2006-12-27 Thread Pyenos
class One: Two() #can't instantiate class Two: Three() #can't instantiate class Three:pass -- http://mail.python.org/mailman/listinfo/python-list

Re: failing to instantiate an inner class because of its order

2006-12-27 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: > class Model: > Controller() #problem > > class View: > Model() > > class Controller:pass > > > Python interpreter complains that 'Name Error: Controller()' not defined. > Following

Re: failing to instantiate an inner class because of order of inner classes

2006-12-27 Thread Pyenos
"Edward Kozlowski" <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > class model:pass > > class view: > > model() > > class controller: > > model() > > > > I can instantiate clsss model from inside class view but I can

failing to instantiate an inner class because of its order

2006-12-27 Thread Pyenos
class Model: Controller() class View: Model() class Controller:pass Python interpreter complains that 'Name Error: Controller()' not defined. -- http://mail.python.org/mailman/listinfo/python-list

failing to instantiate an inner class because of order of inner classes

2006-12-27 Thread Pyenos
class model:pass class view: model() class controller: model() I can instantiate clsss model from inside class view but I can't instantiate class model from inside controller, due to the nature of python interpreter. I wish to circumvent this restriction by: class model:pass clas

Re: let me simplify my question on scope of vars

2006-12-22 Thread Pyenos
Gabriel Genellina <[EMAIL PROTECTED]> writes: > At Friday 22/12/2006 22:24, Pyenos wrote: > > > > > "code" > > > > var=1 > > > > class CLASS: > > > > def METHOD1: > > > > def ME

Re: let me simplify my question on scope of vars

2006-12-22 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: > Pyenos <[EMAIL PROTECTED]> writes: > > i will try to answer my own questions(pls verify): > > > "code" > > var=1 > > class CLASS: > > def METHOD1: > > def METHOD2: >

Re: scopes of local and global variable

2006-12-22 Thread Pyenos
"Max Wilson" <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > does class WORK inherit t_len=0 from line1? > > > > does def getwork() inherit t_len=0 from line1? > > > > does def formattable(table_to_process,type) inherit t_len=0 from line1? >

Re: let me simplify my question on scope of vars

2006-12-22 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: i will try to answer my own questions(pls verify): > "code" > var=1 > class CLASS: > def METHOD1: > def METHOD2: > var+=var > return var >

Re: scopes of local and global variable

2006-12-22 Thread Pyenos
James Stroud <[EMAIL PROTECTED]> writes: > >>>#CODE## > >>>t_len=0 > >>>class WORK: > >>>def getwork(self): > >>>def formattable(table_to_process,type): > >>>TYPE=["p","t","T","s","i"] #list of types to format > >>>if t

let me simplify my question on scope of vars

2006-12-22 Thread Pyenos
"code" var=1 class CLASS: def METHOD1: def METHOD2: var+=var return var METHOD2() #line8 return var METHOD1() #line10 "end code" Q1: do

let me simplify my question about scope of vars

2006-12-22 Thread Pyenos
"code" var=1 class CLASS: def METHOD1: def METHOD2: var+=var return var METHOD2() #line8 return var METHOD1() #line10 Q1: does class CLA

Re: Spyce vs mod_python PSP

2006-12-22 Thread Pyenos
frankly, i don't konw anything about mod_python nor spyce, but i wish you good luck. -- http://mail.python.org/mailman/listinfo/python-list

Re: scopes of local and global variable

2006-12-22 Thread Pyenos
Fredrik Lundh <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > > #CODE## > > t_len=0 > > class WORK: > > def getwork(self): > > def formattable(table_to_process,type): > > TYP

scopes of local and global variable

2006-12-22 Thread Pyenos
#CODE## t_len=0 class WORK: def getwork(self): def formattable(table_to_process,type): TYPE=["p","t","T","s","i"] #list of types to format if type==TYPE[1]:

Re: Confusion over calling a nested function inside a parent function

2006-12-22 Thread Pyenos
"MacDonald" <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > [code] > > class WORK: > > def getwork(self): > > def choosetable(self):pass > > choosetable() #TypeError: choosetable() takes exactly 1 > >

Re: Script Error

2006-12-22 Thread Pyenos
"Forced_Ambitions" <[EMAIL PROTECTED]> writes: > Guys any suggestions ? > > Could it be because of a MS patch or something as i believe i had some > patching on the windows box i was running this script on. > > > Forced_Ambitions wrote: > > > Hi Guys, > > > > I am facing a problem with a scrip

Confusion over calling a nested function inside a parent function

2006-12-22 Thread Pyenos
[code] class WORK: def getwork(self): def choosetable(self):pass choosetable() #TypeError: choosetable() takes exactly 1 #argument (0 given) [/code] Calling choosetable() at the above location gives me the error described above. -- http://mail.python.o

Re: Confusion with calling function of a subclass

2006-12-22 Thread Pyenos
Adonis Vargas <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > class TREE: > > def gettree(self):print self > > TREE.gettree() # I get an error saying# TypeError: > > unbound method gettree() must be called > ># with TREE

Confusion with calling function of a subclass

2006-12-21 Thread Pyenos
class TREE: def gettree(self):print self TREE.gettree() # I get an error saying # TypeError: unbound method gettree() must be called # with TREE instance as first argument (got nothing instead I still don't understand how to solve this simple code. -- http://m

Re: list1.append(list2) returns None

2006-12-21 Thread Pyenos
i rewrote the code following the advices from subdir of the parent thread: # well, table is composed of a list of columns. # so let's stick them together def enlargetable(table,col): table.append(col) # the code won't return sorted lists :-o return_the_fucking_table_bitch=table # assign it

list1.append(list2) returns None

2006-12-20 Thread Pyenos
def enlargetable(table,col): return table.append(col) def removecolfromtable(table,col): return table.remove(col) print enlargetable([[1],[2],[3]],[4]) # returns None Why does it return None instead of [[1],[2],[3],[4]] which I expected? -- http://mail.python.org/mailman/listinfo/python

Re: pickle fun

2006-12-20 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: > class pickle_service: > import cPickle as p > > # accept list as arg then serialize it to a file > def serialize(some_list,picklefile): > f=file(picklefile,"w") > p.dump(some

Re: what is wrong with my code?

2006-12-20 Thread Pyenos
thanks for your point. so because i have said class blah: i must explicitly say self for every instantiation of object? -- http://mail.python.org/mailman/listinfo/python-list

pickle fun

2006-12-20 Thread Pyenos
class pickle_service: import cPickle as p # accept list as arg then serialize it to a file def serialize(some_list,picklefile): f=file(picklefile,"w") p.dump(some_list,f) # so dumped this shit to the file f.close() # which one

Re: what is wrong with my code?

2006-12-20 Thread Pyenos
gt; a container of many many smaller questions, and you need to focus your > questions better. > > On 21 Dec 2006 09:16:58 +1100, Pyenos <[EMAIL PROTECTED]> wrote: > > import cPickle, shelve > > > > could someone tell me what things are wrong with my

calling a class instance of function

2006-12-20 Thread Pyenos
class pid: "pid" def add(original_pid,toadd): "add pid" original_pid.append(toadd) return original_pid def remove(something_to_remove_from,what): "remove pid" something_to_remove_from.remove(what) return something_to_remove_from def m

what is wrong with my code?

2006-12-20 Thread Pyenos
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):