PC locks up with list operations

Tim Chase python.list at tim.thechases.com
Thu Sep 1 02:53:48 CEST 2011


On 08/31/11 18:31, Gregory Ewing wrote:
> The Python process should also be able to set its own
> limits using resource.setrlimit().

A new corner of stdlib that I've never poked at.  Thanks for the 
suggestion.  Disappointed though that it doesn't seem to have 
docstrings on the functions, so I had to wade back out to the 
online docs to probe at it.  Granted, after the fact, they were 
pretty obvious, but it would be nice if 
"help(resource.getrlimit)" gave me a hint as to what that one 
expected parameter should have been.

-tim

   import resource as r
   token = "RLIMIT_"
   for item in dir(r):
     if item.startswith(token):
       print "%s:" % item[len(token):],
       print "%s hard/%s soft" % r.getrlimit(getattr(r, item))






More information about the Python-list mailing list