[Tutor] Question about the memory manager

2016-01-10 Thread Albert-Jan Roskam
Hi, I just found a neat trick to free up an emergency stash of memory in a funtion that overrides sys.excepthook. The rationale is that all exceptions, including MemoryErrors will be logged. The code is below. My question: is that memory *guaranteed* to be freed right after the 'del'

Re: [Tutor] Question about the memory manager

2016-01-10 Thread Steven D'Aprano
On Sun, Jan 10, 2016 at 11:53:22AM +, Albert-Jan Roskam wrote: > Hi, > > I just found a neat trick to free up an emergency stash of memory in a > funtion that overrides sys.excepthook. > rainydayfund = [[] for x in xrange(16*1024)] # or however much you need > def handle_exception(e): >

Re: [Tutor] Question about the memory manager

2016-01-10 Thread Tim Peters
[Albert-Jan Roskam ] > I just found a neat trick to free up an emergency stash of memory in > a funtion that overrides sys.excepthook. The rationale is that all > exceptions, including MemoryErrors will be logged. > The code is below. My question: is that memory

Re: [Tutor] Question about the memory manager

2016-01-10 Thread Peter Otten
Albert-Jan Roskam wrote: > Hi, > > I just found a neat trick to free up an emergency stash of memory in a > funtion that overrides sys.excepthook. The rationale is that all > exceptions, including MemoryErrors will be logged. The code is below. My > question: is that memory *guaranteed* to be

Re: [Tutor] (no subject)

2016-01-10 Thread Peter Otten
Lawrence Lorenzo wrote: > import randomimport timeimport math > #the player and NPC class.class char(object): #character attributesdef > #__init__(self, name, health, attack, rng, magic, speed):self.name > #= nameself.health = healthself.attack = attack >

Re: [Tutor] (no subject)

2016-01-10 Thread Alan Gauld
On 10/01/16 15:21, Lawrence Lorenzo wrote: Please use plain text to send mail. Your formatting makes the code unreadable. Thankfully the error does all the work for us... > import randomimport timeimport math > #the player and NPC class.class char(object): #character attributesdef >

[Tutor] (no subject)

2016-01-10 Thread Lawrence Lorenzo
import randomimport timeimport math #the player and NPC class.class char(object): #character attributesdef __init__(self, name, health, attack, rng, magic, speed):self.name = nameself.health = healthself.attack = attackself.speed = rngself.magic =