Re: easy question, how to double a variable

2009-09-23 Thread Casey Webster
On Sep 22, 9:57 am, Grant Edwards inva...@invalid.invalid wrote: No, no, no.  The plan is to do his homework for him so that he's incompetent when he graduates and won't be competition for the rest of us who did do our homework. Don't forget the Peter principal --- we might end up working for

Re: Suggestions for Python MapReduce?

2009-07-22 Thread Casey Webster
On Jul 22, 5:27 am, Phillip B Oldham phillip.old...@gmail.com wrote: I understand that there are a number of MapReduce frameworks/tools that play nicely with Python (Disco, Dumbo/Hadoop), however these have large dependencies (Erlang/Java). Are there any MapReduce frameworks/ tools which are

Re: performance problem with time.strptime()

2009-07-02 Thread Casey Webster
On Jul 2, 7:30 am, Nils Rüttershoff n...@ccsg.de wrote: Rec = re.compile(r^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s-\s\d+\s\[(\d{2}/\w+/\d{4}:\d{2}:\d{2}:\d{2})\s\+\d{4}\].*) Line = '1.2.3.4 - 4459 [02/Jul/2009:01:50:26 +0200] GET /foo HTTP/1.0 200 - - www.example.org - - -' I'm not sure how much

Re: PEP368 and pixeliterators

2009-07-02 Thread Casey Webster
On Jul 2, 4:32 am, Joachim Strömbergson joac...@strombergson.com wrote: But, wouldn't it be more Pythonic and simpler to have an iterator that iterates over all pixels in an image? Starting with upper left corner and moving left-right and (line by line) to lower right. This would change the

Re: strip char from list of strings

2009-05-19 Thread Casey Webster
On May 18, 3:30 pm, Laurent Luce laurentluc...@yahoo.com wrote: I have the following list: [ 'test\n', test2\n', 'test3\n' ] I want to remove the '\n' from each string in place, what is the most efficient way to do that ? Regards, Laurent Do you _really_ need to do this in place? If

Re: How complex is complex?

2009-03-18 Thread Casey Webster
On Mar 18, 1:30 pm, Kottiyath n.kottiy...@gmail.com wrote: When we say readability counts over complexity, how do we define what level of complexity is ok? For example: Say I have dict a = {'a': 2, 'c': 4, 'b': 3} I want to increment the values by 1 for all keys in the dictionary. So, should

Re: How to add months to a date (datetime object)?

2009-03-15 Thread Casey Webster
On Mar 15, 2:00 pm, tinn...@isbd.co.uk wrote: No, it's perfectly possible applying simple logic.  My reminder program manages it perfectly well.  I have, for example, two sets of three monthly reminders.     One starts on Jan 19th and repeats three monthly, that means Jan     19th, April

Re: Compute working days

2009-03-14 Thread Casey Webster
How about: from datetime import date, timedelta # Define the weekday mnemonics to match the date.weekday function (MON, TUE, WED, THU, FRI, SAT, SUN) = range(7) def workdays(start_date, end_date, whichdays=(MON,TUE,WED,THU,FRI)): ''' Calculate the number of working days between two