Feature suggestion -- return if true
prologic at shortcircuit.net.au
Wed Apr 13 05:28:35 CEST 2011
On Wed, Apr 13, 2011 at 1:00 PM, Chris Angelico <rosuav at gmail.com> wrote:
> def foo(param):
> resource=malloc(50000) # Shtarker, zis is Python! We don't malloc here!
> if not resource: return 0
> 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:
with ResourceAllocator(50000) as resource:
resource[param] = 5
Now I know I'm only adding to the discussion (argument) but
hey it's all in good fun until someone looses an eyeball!
-- James Mills
-- "Problems are solved by method"
More information about the Python-list