Re: Python's garbage collection was Re: Python reliability
Paul Rubin wrote: > I haven't been keeping up with this stuff in recent years so I have a > worse concern. I don't know whether it's founded or not. Basically > in the past decade or so, memory has gotten 100x larger and cpu's have > gotten 100x faster, but memory is less than 10x faster once you're out > of the cpu cache. The mark phase of mark/sweep tends to have a very > random access pattern (at least for Lisp). In the old days that > wasn't so bad, since a random memory access took maybe a couple of cpu > cycles, but today it takes hundreds of cycles. So for applications > that use a lot of memory, simple mark/sweep may be a much worse dog > than it was in the Vax era, even if you don't mind the pauses. You pay a price for CG one way or the other. In Python the price is spread out among a bunch of increment and decrement operations in the code. For mark and sweep the price is a big operation done less often. My understanding from reading about GC implementations is that reference counting can exhibit poor cache performance because decrementing a reference can lead to a chain of decrements on objects that can be laid out in memory in a fairly random fashion. Mark and sweep can be a better cache performer since it's memory access will tend to be more linear. -- http://mail.python.org/mailman/listinfo/python-list
Re: newbie question concerning formatted output
>>> a = [str(i) for i in range(0,17)] >>> for i in range(0,len(a),3): ... print " ".join(a[i:i+3]) ... 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 -- http://mail.python.org/mailman/listinfo/python-list
Re: Moinmoin config
Mark wrote: > Hi, > > I have Moinmoin 1.3.4 installed and working on Linux RHEL3.0. However, > all screen elements are lined up on the left hand side. How can I get > it displayed like the wiki at: Well, this is probably a better question for the moin lists but I have seen this behavior before. I would check the data_underlay_dir = './underlay/' line in your wikiconfig.py file. If it's not getting the right templates it won't format the page right. This is the only advice I can give. Beyond this I don't know what else you can try. > > http://moinmoin.wikiwikiweb.de/HelpOnConfiguration > > instead of this ? -> > > LANShieldOS Release Notes > Search: > > * MarkRuedy > * UserPreferences > > * HelpOnEditing > * HelpContents > * HelpForBeginners > * UserPreferences > > * FrontPage > * RecentChanges > * FindPage > * HelpContents > > * Edit > * Show Changes > * Get Info > * Subscribe > * > > FrontPage -- http://mail.python.org/mailman/listinfo/python-list
Re: What is proper way to require a method to be overridden?
jeremito wrote:
> I am writing a class that is intended to be subclassed. What is the
> proper way to indicate that a sub class must override a method?
>
> Thanks,
> Jeremy
Decorators to the rescue?
def must_override(f):
def t(*args):
raise NotImplementedError("You must override " + f.__name__)
return t
class Foo:
@must_override
def Bar(x,y): pass
Foo().Bar()
Traceback (most recent call last):
File "testit.py", line 14, in ?
Foo().Bar()
File "testit.py", line 5, in t
raise NotImplementedError("You must override " + f.__name__)
NotImplementedError: You must override Bar
--
http://mail.python.org/mailman/listinfo/python-list
Re: If - Or statements
What about:
if True in [thefile.endswith(x) for x in
('mp3','mp4','ogg','aac','wma')]:
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python in Games (was RE: [Stackless] Python in Games)
My understanding is that the upcoming Civilization IV will have python scripting. -- http://mail.python.org/mailman/listinfo/python-list
Re: if __name__ == 'main':
On Mar 20, 11:49 am, "gtb" <[EMAIL PROTECTED]> wrote: > Hi, > > I often see the following 'if' construct in python code. What does > this idiom accomplish? What happens if this is not main? How did I get > here if it is not main? A quick example demonstrates the usage: C:\code>type temp.py print "Module name is",__name__ if __name__ == "__main__": print "I was not imported" else: print "I was imported" C:\code>python temp.py Module name is __main__ I was not imported C:\code>python Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import temp Module name is temp I was imported -- http://mail.python.org/mailman/listinfo/python-list
