On Sat, 26 Nov 2005 20:54:49 -0800
Robert Kern <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > So, two options:
> > 
> > from os import *
> > import os

> > One of these two ways you're not supposed to use for
> > security reasons, but I'm spacing on which one.
> 
> I don't think there are any *security* reasons, but
> stylistically, "import os" is greatly preferred. When
> someone else reads your code, they will immediately know
> where getcwd() comes from.

It's not a question of "security" in the usual sense, but
the first syntax imports a lot of stuff into the current
namespace, increasing the risk of unintentionally clobbering
local names. So it's certainly "riskier" in the sense of
"likely to cause bugs".


-- 
Terry Hancock ([EMAIL PROTECTED])
Anansi Spaceworks http://www.AnansiSpaceworks.com

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to