Re: Better dict of dicts

2007-04-19 Thread John Bauman
Adam Atlas wrote: > On Apr 19, 5:24 pm, Bill Jackson <[EMAIL PROTECTED]> wrote: >> I have a dictionary of dictionaries where the keys are typically very >> long tuples and repeated in each inner dictionary. The dictionary >> representation is nice because it handles sparseness well...and it is >>

Re: How naive is Python?

2007-01-15 Thread John Bauman
[EMAIL PROTECTED] wrote: > Actually, it isn't until I work my way back to 2.3 that I start to see > quadratic behavior: Yes, that's because the behavior was changed for 2.4, so it wouldn't be quadratic in this case. -- http://mail.python.org/mailman/listinfo/python-list

Re: running commands with sudo & python

2006-09-28 Thread John Bauman
[EMAIL PROTECTED] wrote: > Hi! > I must execute a command with os.command(), but with root permissions. > Is there anyway to do that with python? > Thanks > http://en.wikipedia.org/wiki/Setuid Of course, it's not generally a good idea to have your program keep root permissions after it does what

Re: Cellular automata and image manipulation

2006-05-13 Thread John Bauman
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. I have recently been experimenting with cellular automata and I > would like to know how I could convert a 2d list of 0's and 1's into > white and black squares on an image. I have tried to install matplotlib > and also NumTut b

Re: win32com, BSTR, and null terminated strings

2006-02-05 Thread John Bauman
"Matt Helm" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > However, what is the proper way to recover the actual string? I have > been using: > >r.split("\0", 1)[0] > I'd prefer to use r[:-1] to strip off the last character of the string. -- http://mail.python.org/mailman/l

Re: newbie: working iwth list of tuples

2006-01-29 Thread John Bauman
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > "falcon" <[EMAIL PROTECTED]> writes: >> I forgot to add that I passing a tuple of functions to the reduce >> function but apparently that is not allowed. My guess was that a tuple >> made up of individual (simple)

Re: Python String Substitution

2006-01-26 Thread John Bauman
"Murali" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In Python, dictionaries can have any hashable value as a string. In > particular I can say > > d = {} > d[(1,2)] = "Right" > d["(1,2)"] = "Wrong" > d["key"] = "test" > > In order to print "test" using % substitution I can say

Re: 2D canvas for GTK

2006-01-08 Thread John Bauman
"Sandro Dentella" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I need a (decent) canvas for PyGTK. I used tkinter.canvas with real >pleasure > in the past but now I need to use the canvas in a Gtk application. Does > anybody know of one with similar capabilities? It must work on

Re: print UTF-8 file with BOM

2005-12-23 Thread John Bauman
UTF-8 shouldn't need a BOM, as it is designed for character streams, and there is only one logical ordering of the bytes. Only UTF-16 and greater should output a BOM, AFAIK. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode-aware file shortcuts in Windows

2005-09-16 Thread John Bauman
"Stanislaw Findeisen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does anyone know how to create file shortcuts in Windows? > > The only way I know is like: > > --- > > import win32com.client > > wScriptShellObject = wi