I've been wanting a little widget for storing passwords, account numbers, etc. Wrote this. I'm pretty sure it works. Any feedback appreciated. If you find...
... Hash: SHA1 I didn't have too much time to take a look, but one thing I did notice that you could do would be to take advantage of the cmd module in the...
... Cool, I didn't know about that module. Thanks! -- Jeff Jeff Abrahamson <http://jeff.purple.com/> +1 215/837-2287 GPG fingerprint: 1A1A BA95 D082...
I'm using getopt.gnu_getopt(). Anyone know of a way to specify an option with an optional argument, like getopt(3) does with a double colon: foo -c foo -c arg ...
I'm guessing it doesn't work with the way you're used to? I think gnu_getopt is supposed to behave the way gnu getopt does. I haven't tried it, nor have I ever...
I have a list comprehension that looks like this: L = [ T.list() for T in self.cdr ] The function T.list() returns a list. What I get therefore looks like ...
... Thanks. I gave too simple an example, I'm afraid. I call this recursively (it's part of a tree walk), so one example is this: ['barnyard', ['cow'],...
... Hash: SHA1 Yeah, I realized this. After looking at self.cdr, I figured that you're probably trying to nest lists deep. Your untested code would be correct...
... One easy way to do this is something like: def flatten(x): if hasattr(x, "__iter__"): result = [] for y in x: result.extend(flatten(y)) return result else:...
Erik Osheim
erik@...
May 16, 2006 2:09 am
172
I just realized that we didn't actually answer your original question. We come as far as actually creating a way to do what you need, but not with list...
I would use the reduce() function with a simple add lambda as follows: L = reduce(lambda x,y: x+y, [T.list() for T in self.cdr]) Guido wants to get rid of...
... [1, 2, 3] ... [[1], 2, 3] ... This unfortunately doesn't work for the general case. I'm not sure if Jeff was actually looking for the general case though....
... Since the data structure itself is recursive, then you probably are going to have a fairly significant block of code to take it apart iteratively. The...
... That's a nice method, but in this case it's probably needlessly recursive (since it recurses twice for each element, once for the "car" and once for the...
Erik Osheim
erik@...
May 16, 2006 6:11 pm
177
Tkinter is pre-packaged, of course, but wxPython seems to be a standard for anything requiring more than a few simple widgets.. I've given PyQt a try (loved it...
I've used and liked PyGTK. I haven't used it in a while, and not since version 2.3 or 2.4, but it was nice fairly well documented and pretty intuitive. Lately...
I can definitely recommend wxPython as well. Learning to use sizers can be tricky, but the documentation is good and the demo application demonstrates each ...
(answering initial questionnaire) I've been using Python for about 3 years. I started using it at work part-time, as a scripting/glue language in projects....
... I have found PyGTK to be pretty good. However, I primarily use curses (although technically that's not a GUI). I've heard wxPython was great, but haven't...
Erik Osheim
erik@...
May 19, 2006 2:33 pm
182
... TKinter is awful for anything larger than a calculator. Anyone ever built Tk apps with TCL? They go hand in hand, I can't imagine that together they...
This feels like a lame question, but I've been struggling with it for too long now. I have an XML document (no DTD) and I want to think of it as a tree. I...
... Hash: SHA1 Perhaps Frederik Lundt's cElementTree is what you're refering too? I haven't used it personally, as I avoid XML whenever I can (I hate it and...
So, I stumbled upon google-goopy which implements some common functional programming functions, one of which happened to be flatten. Since it's BSD licensed, I...
Here's the beginning of a class declaration from the package NetworkX. I'm bamboozled on two points: - What does it mean to derive from "object" vs declaring...
... It declares, explicitly, that the class is a "new style" object. ... It creates a dictionary of all of the keyword arguments passed in. Peace, Gary ...
... class Foo(object) means that Foo is a new-style class. In particular, this means that you can define a __new__ method, which is used as a factory method to...
Erik Osheim
erik@...
Jun 10, 2006 10:56 pm
191
Is there a way to do good syntax checking all at once on a python program (with modules)? Each time I run, I'm told of one error, the first one it finds. But...