Re: Python object overhead?

2007-03-23 Thread Mark Nenadov
get around some overhead with the objects. However, in terms of generally efficiency not specifically related to object instantiation, you should look into xreadlines(). I'd suggest doing the following instead of that while loop: for line in open(sys.argv[1]).xreadlines(): .. -- Mark Nenadov

Re: Python object overhead?

2007-03-23 Thread Mark Nenadov
forgotten about that! I've tested them before. readlines() is very slow. The deprecated xreadlines() is close in speed to open() as an iterator. In my particular test, I found the following: readlines() - 32 time units xreadlines() - 0.7 time units open() iterator - 0.41 time units -- Mark

Re: Randomizing in Python

2007-03-03 Thread Mark Nenadov
for a game. What would be necessary to do so? Look into the random module (http://docs.python.org/lib/module-random.html) random.choice selects a random item out of a sequence random.shuffle shuffles a sequence randomly random.random gives a random floating point number -- Mark Nenadov - skype

Re: Finding user's home dir

2005-02-02 Thread Mark Nenadov
(Python 2.3.3 on Linux) and it returned the home directory properly - - Mark Nenadov Python Byte Solutions http://www.pythonbyte.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a module's byte code, how?

2005-02-02 Thread Mark Nenadov
API documentation says that code objects have co_code, which is a string of raw compiled bytecode. Hope that helps! - - Mark Nenadov Python Byte Solutions http://www.pythonbyte.com/ -- http://mail.python.org/mailman/listinfo/python-list