dynamically selecting a class to instantiate based on the object attributes.

2012-05-09 Thread J. Mwebaze
I have a bunch of objects of the same type. Each object has a version attribute and this refers to source code that was used to make the object. SouceCode is maintained in separate files. eg. myclass_01.py, myclass_02.py, myclass_03.py, myclass_04.py .. During object instantiaton, i would like to

Re: sorting 1172026 entries

2012-05-06 Thread J. Mwebaze
I noticed the error in code please ignore this post.. On Sun, May 6, 2012 at 6:29 PM, J. Mwebaze wrote: > sorry see, corrected code > > > for filename in txtfiles: >temp=[] >f=open(filename) >for line in f.readlines(): > line = line.strip(

Re: sorting 1172026 entries

2012-05-06 Thread J. Mwebaze
rted', 'wb') as p: for i, j in temp: p.write('%s %s\n' %(str(i),j)) On Sun, May 6, 2012 at 6:26 PM, J. Mwebaze wrote: > I have attached one of the files, try to sort and let me know the results. > Kindly sort by date. ooops - am told the fil

Re: sorting 1172026 entries

2012-05-06 Thread J. Mwebaze
7;%s %s\n' %(str(i),j)) On Sun, May 6, 2012 at 6:21 PM, Devin Jeanpierre wrote: > On Sun, May 6, 2012 at 12:11 PM, J. Mwebaze wrote: > > [ (datatime, int) ] * 1172026 > > I can't duplicate slowness. It finishes fairly quickly here. Maybe you > could try posting spe

Re: sorting 1172026 entries

2012-05-06 Thread J. Mwebaze
On Sun, May 6, 2012 at 6:09 PM, Devin Jeanpierre wrote: > On Sun, May 6, 2012 at 11:57 AM, J. Mwebaze wrote: > > I have several lists with approx 1172026 entries. I have been trying to > sort > > the records, but have failed.. I tried lists.sort() i also trired sorted > >

Re: sorting 1172026 entries

2012-05-06 Thread J. Mwebaze
On Sun, May 6, 2012 at 6:07 PM, Benjamin Schollnick wrote: > > On May 6, 2012, at 11:57 AM, J. Mwebaze wrote: > > I have several lists with approx 1172026 entries. I have been trying to > sort the records, but have failed.. I tried lists.sort() i also trired > sorted pytho

sorting 1172026 entries

2012-05-06 Thread J. Mwebaze
I have several lists with approx 1172026 entries. I have been trying to sort the records, but have failed.. I tried lists.sort() i also trired sorted python's inbuilt method. This has been running for weeks. Any one knows of method that can handle such lists. cheers -- *Mob UG: +256 (0) 70 17

Re: How to compute a delta: the difference between lists of strings

2012-05-05 Thread J. Mwebaze
thank Chris.. On Sat, May 5, 2012 at 2:39 PM, Chris Angelico wrote:k > On Sat, May 5, 2012 at 10:12 PM, J. Mwebaze wrote: > > This is out of curiosity, i know this can be done with python diffllib > > module, but been figuring out how to compute the delta, Consider two &g

try/except in a loop

2012-05-02 Thread J. Mwebaze
I have multiple objects, where any of them can serve my purpose.. However some objects might not have some dependencies. I can not tell before hand if the all the dependencies exsit. What i want to is begin processing from the 1st object, if no exception is raised, i am done.. if an exception is ra

Re: Code help for understand

2012-05-02 Thread J. Mwebaze
if you are referring to the line * * *if __name__ == '__main__':* * * Find a good explanation here * * http://stackoverflow.com/questions/419163/what-does-if-name-main-do On Wed, May 2, 2012 at 2:30 PM, viral shah wrote: > Hi > > in every .py file I found this same code line on the below side

algorithm does python use to compare two strings

2012-04-29 Thread J. Mwebaze
I am just wondering which specific algorithm does python use to compare two strings. Could it be the Longest common subsequence is the most u Regards -- *Mob UG: +256 (0) 70 1735800 | NL +31 (0) 6 852 841 38 | Gtalk: jmwebaze | skype: mwebazej | URL: www.astro.rug.nl/~jmwebaze /* Life runs on

class versions and object deserialization

2012-04-24 Thread J. Mwebaze
We have classes of this form classA version1, classA version2, classA version3 .. etc. This is same class that has been modified. Each "modification" creates a new version of a class. Each object has a version attribute which refers to the version of the class from which it was derived. egObjectA.v

CFG for python

2012-03-28 Thread J. Mwebaze
Anyone knows how to create control-flow-graph for python.. After searching around, i found this article, http://www.python.org/dev/peps/pep-0339/#ast-to-cfg-to-bytecode and also a reference to http://doc.pypy.org/en/latest/objspace.html#the-flow-model However, i stil cant figure out what how to

Message passing between python objects

2012-03-19 Thread J. Mwebaze
I am trying to learn about the interaction between python objects. One thing i have often read is that objects interact by sending messages to other objects to invoke corresponding methods. I am specifically interested in tracing these messages and also probably log the messages for further scrutin