Re: Sending changed parameters into nested generators

2010-11-18 Thread cbr...@cbrownsystems.com
On Nov 12, 10:52 pm, "John O'Hagan" wrote: > On Sat, 13 Nov 2010, Steven D'Aprano wrote: > > On Fri, 12 Nov 2010 09:47:26 +, John O'Hagan wrote: > > > I have a generator function which takes as arguments another generator > > > and a dictionary of other generators like this: > > > > def modgen

Re: IDLE debugger questions

2010-11-13 Thread cbr...@cbrownsystems.com
On Oct 23, 7:29 am, Roger Davis wrote: > Are there any Python debuggers with a decent GUI out there at all that > will work on a Mac with the following features: (i) ability to pass in > a sys.srgv[] list that the program would otherwise see without the > debugger, (ii) display local variables,

Re: multiple discontinued ranges

2010-11-11 Thread cbr...@cbrownsystems.com
On Nov 10, 10:02 am, Mel wrote: > xoff wrote: > > I was wondering what the best method was in Python programming for 2 > > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. > > Am I obliged to use 2 for loops defining the 2 ranges like this: > > > for i in range (3,7): > > do

Re: text file reformatting

2010-11-01 Thread cbr...@cbrownsystems.com
On Nov 1, 1:58 am, iwawi wrote: > On 1 marras, 09:59, "cbr...@cbrownsystems.com" > > > > wrote: > > On Oct 31, 11:46 pm, iwawi wrote: > > > > On 31 loka, 21:48, Tim Chase wrote: > > > > > > PRJ01001 4 00100END > > > > &g

Re: text file reformatting

2010-11-01 Thread cbr...@cbrownsystems.com
On Oct 31, 11:46 pm, iwawi wrote: > On 31 loka, 21:48, Tim Chase wrote: > > > > > > PRJ01001 4 00100END > > > PRJ01002 3 00110END > > > > I would like to pick only some columns to a new file and put them to a > > > certain places (to match previous data) - definition file (def.csv) > > > could be

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-31 Thread cbr...@cbrownsystems.com
On Oct 31, 4:27 pm, Lawrence D'Oliveiro wrote: > In message > <687bcb76-0093-4d68-ba56-0390a3e1e...@30g2000yql.googlegroups.com>, > > cbr...@cbrownsystems.com wrote: > > I should note that efficiency is not an issue to me here; this is for > > when you have,

Re: text file reformatting

2010-10-31 Thread cbr...@cbrownsystems.com
On Oct 31, 12:48 pm, Tim Chase wrote: > > PRJ01001 4 00100END > > PRJ01002 3 00110END > > > I would like to pick only some columns to a new file and put them to a > > certain places (to match previous data) - definition file (def.csv) > > could be something like this: > > > VARIABLE   FIELDSTARTS

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread cbr...@cbrownsystems.com
On Oct 29, 2:43 am, Steven D'Aprano wrote: > On Thu, 28 Oct 2010 09:16:42 -0700, cbr...@cbrownsystems.com wrote: > > It's clear but tedious to write: > > > if 'monday" in days_off or "tuesday" in days_off: > >     doSomething > >

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread cbr...@cbrownsystems.com
On Oct 28, 11:56 am, Arnaud Delobelle wrote: > "cbr...@cbrownsystems.com" writes: > > It's clear but tedious to write: > > > if 'monday" in days_off or "tuesday" in days_off: > >     doSomething > > > I currently am tend

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-28 Thread cbr...@cbrownsystems.com
On Oct 28, 10:05 am, Chris Rebert wrote: > On Thu, Oct 28, 2010 at 9:33 AM, cbr...@cbrownsystems.com > > > > wrote: > > On Oct 28, 9:23 am, John Posner wrote: > >> On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote: > > >> > It's clear but

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-28 Thread cbr...@cbrownsystems.com
On Oct 28, 9:23 am, John Posner wrote: > On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote: > > > It's clear but tedious to write: > > > if 'monday" in days_off or "tuesday" in days_off: > >      doSomething > > > I currently am t

Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-28 Thread cbr...@cbrownsystems.com
It's clear but tedious to write: if 'monday" in days_off or "tuesday" in days_off: doSomething I currently am tending to write: if any([d for d in ['monday', 'tuesday'] if d in days_off]): doSomething Is there a better pythonic idiom for this situation? Cheers - Chas -- http://mail.p

Re: lists and list item matches (ghost wodgame)

2010-09-22 Thread cbr...@cbrownsystems.com
On Sep 22, 3:39 pm, Baba wrote: > On Sep 22, 9:18 pm, Baba wrote: > > > > > On Sep 22, 3:38 pm, nn wrote: > > > > On Sep 21, 6:39 pm, Baba wrote: > > > > > Hi > > > > > query level: beginner > > > > > as part of a learning exercise i have written code that: > > > wordlist = ['hello', 'bye']

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-18 Thread cbr...@cbrownsystems.com
On Aug 18, 11:50 am, John Posner wrote: > On 8/18/2010 1:38 PM, cbr...@cbrownsystems.com wrote: > > >>> To go the other way, if d = 1, then there exists integers (not > >>> neccessarily positive) such that > > >>> a*x + b*y + c*z = 1 > > That

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-18 Thread cbr...@cbrownsystems.com
On Aug 18, 10:52 am, Baba wrote: > Hi Chas > > Thanks for that and i agree on your last remark :) > > re the number of required consecutive passes required: > > The number of required consecutive passes is equal to the smallest > number because after that you can get any amount of nuggets by just

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-18 Thread cbr...@cbrownsystems.com
On Aug 17, 2:44 pm, Baba wrote: > On Aug 16, 6:28 pm, "cbr...@cbrownsystems.com" > > wrote: > > First, suppose d = gcd(x, y, z); then for some x', y', z' we have that > > x = d*x', y = d*y', z = d*z'; and so for any a, b, c: > &g

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread cbr...@cbrownsystems.com
On Aug 16, 11:04 am, Baba wrote: > Hi Chas, Roald, > > These are all complicated formula that i believe are not expected at > this level. If you look at the source (see my first submission) you > will see that this exercise is only the second in a series called > "Introduction to Programming". The

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread cbr...@cbrownsystems.com
On Aug 16, 1:23 am, Roald de Vries wrote: > On Aug 15, 2010, at 11:51 PM, Ian Kelly wrote: > > > > > On Sun, Aug 15, 2010 at 4:36 PM, Baba wrote: > >> Hi Mel, > > >> indeed i thought of generalising the theorem as follows: > >> If it is possible to buy n, n+1,…, n+(x-1) sets of McNuggets, for   >