On Sun, Nov 15, 2009 at 4:00 AM, Terry Reedy wrote:
> Yoav Goldberg wrote:
>
>
>> On Sun, Nov 15, 2009 at 12:10 AM, Terry Reedy > tjre...@udel.edu>> wrote:
>>
>>Paul Rubin wrote:
>>
>>Mark Chu-Carroll has a new post about Go:
&
On Sun, Nov 15, 2009 at 12:10 AM, Terry Reedy wrote:
> Paul Rubin wrote:
>
> Mark Chu-Carroll has a new post about Go:
>>
>>
>> http://scienceblogs.com/goodmath/2009/11/the_go_i_forgot_concurrency_an.php
>>
>
> In a couple of minutes, I wrote his toy prime filter example in Python,
> mostly from
A lot of my code supplement/replace the constructor with class factory
methods.
So, instead of:
> a= A(...)
I would write:
> a = A.from_file(...)
> a = A.create(...)
etc.
This is implemented as follows:
class A:
def __init__(self, ...): pass
@classmethod
def from_file(cls, ):
I use the idiom "for line in file('filename'): do_something(line)" quite a
lot.
Does it close the opened file at the end of the loop, or do I have to
explicitly save the file object and close it afterward?
Yoav
--
http://mail.python.org/mailman/listinfo/python-list
I'm using python for research related programming, and so I write many
experimental small pieces of code.
I would like to organize them into directory structure in
which there is a 'main' directory, and under it directories for
specific sub-tasks, or sub-experiments, I'm running (let's call them
Hello,
I need to have a dictionary of dictionaries of numbers, and I would like the
dictionaries to be defaultdicts, because it makes the code much nicer
(I want to be able to do: d['foo']['bar']+=1 ).
So naturally, I used:
d = defaultdict(lambda :defaultdict(int))
It works great, but now I c