Don't want child process inheriting open sockets

2008-01-22 Thread Steven Watanabe
I'm using subprocess.Popen() to create a child process. The child process is inheriting the parent process' open sockets, but I don't want that. I believe that on Unix systems I could use the FD_CLOEXEC flag, but I'm running Windows. Any suggestions? -- http://mail.python.org/mailman/listinfo/p

Why does built-in set not take keyword arguments?

2006-05-04 Thread Steven Watanabe
I'm trying to do something like this in Python 2.4.3: class NamedSet(set): def __init__(self, items=(), name=''): set.__init__(self, items) self.name = name class NamedList(list): def __init__(self, items=(), name=''): list.__init__(self, items) self.name = name I can do: >>

Comparisons and singletons

2006-03-25 Thread Steven Watanabe
PEP 8 says, "Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators." I know that "is" is an identity operator, "==" and "!=" are the equality operators, but I'm not sure what other singletons are being referred to here. Also, I've seen code t

Question about idioms for clearing a list

2006-01-31 Thread Steven Watanabe
I know that the standard idioms for clearing a list are: (1) mylist[:] = [] (2) del mylist[:] I guess I'm not in the "slicing frame of mind", as someone put it, but can someone explain what the difference is between these and: (3) mylist = [] Why are (1) and (2) preferred? I think the fi