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
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
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
(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
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