On Wed, Apr 13, 2011 at 1:00 PM, Chris Angelico <ros...@gmail.com> wrote: > def foo(param): > resource=malloc(50000) # Shtarker, zis is Python! We don't malloc here! > if not resource: return 0 > resource[param]=5 > del resource > return 1
In Python this can probably be done and perhaps is slightly more readble with the "with" statement and a context manager: def foo(param): try: with ResourceAllocator(50000) as resource: resource[param] = 5 return 1 except: return 0 Now I know I'm only adding to the discussion (argument) but hey it's all in good fun until someone looses an eyeball! cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list