Re: Iterating over several lists at once

2006-12-13 Thread Mike Erickson
* at ([EMAIL PROTECTED]) wrote: > Sorry for breaking into this thread, but I agree completely that any > unnecessary indentations should be avoided. For the same reason I advocate > that the following syntax should work: > > for x in some_list if some_condition: > ... code

Re: Want to reduce steps of an operation with dictionaries

2006-10-24 Thread Mike Erickson
* [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: > Hello: > I have next dictionaries: > a={'a':0, 'b':1, 'c':2, 'd':3} > b={'a':0, 'c':1, 'd':2, 'e':3} > I want to put in a new dictionary named c all the keys that are in b > and re-sequence the values. The result I want is: > c={'a':0, 'c':1, 'd':2}

Re: Can optparse do dependencies?

2006-02-26 Thread Mike Erickson
* Bob ([EMAIL PROTECTED]) wrote: > I'd like to setup command line switches that are dependent on other > switches, similar to what rpm does listed below. From the grammar below > we see that the "query-options" are dependent on the query switch, > {-q|--query}. Can "optparse" do this or do I have t

Re: Checking length of each argument - seems like I'm fighting Python

2005-12-03 Thread Mike Erickson
* Brendan ([EMAIL PROTECTED]) wrote: [...] > Is there a simpler way to check that either all arguments are scalars, > or all are lists of the same length? Is this a poor way to structure > things? Your advice is appreciated Disclaimer: I am new to python, so this may be a bad solution. import t