Why don't people like lisp?
Bjorn Pettersen
bjorn.pettersen at comcast.net
Fri Oct 24 19:59:39 EDT 2003
tfb at famine.OCF.Berkeley.EDU (Thomas F. Burdick) wrote in
news:xcvsmlipkal.fsf at famine.OCF.Berkeley.EDU:
> Bjorn Pettersen <bjorn.pettersen at comcast.net> writes:
>
>> Raymond Wiker <Raymond.Wiker at fast.no> wrote:
>>
>> > "Rainer Deyke" <rainerd at eldwood.com> writes:
>> >
>> > > Personally I'd prefer guaranteed immediate destructors over
>> > > with-open-file. More flexibility, less syntax, and it matches
>> > > what the CPython implementation already does.
>> >
>> > Right... all along until CPython introduces a more
>> > elaborate
>> > gc scheme.
>>
>> ... which is highly unlikely to happen without preservation of
>> reference counting semantics for files... google if you're _really_
>> interested :-/
>
> I hope you put assertion in your code so that it won't run under
> Jython, because that's the kind of insidious bug that would be
> *aweful* to find the hard way.
I'm assuming the "import win32con" etc., will do :-) Seriously, this
would be a minor issue compared with everything else I want to connect
to (e.g. 950KLocs of legacy c++ -- somehow I don't think I'd get the go-
ahead to rewrite that in Java <smile>).
> (I really don't understand why you wouldn't just want at least real
> closures, so you can just use call_with_open_file, and not have to
> worry about what GC you're using when *opening* *files*)
I'm not the one worrying here <wink>. I know exactly what Python does
and it is no cognitive burden. How would you rewrite these without
obfuscating the real work with book-keeping tasks, or leaving the file
open longer than necessary?
timestamp = datetime.now().strftime('%Y%m%d%H%M%S\n')
file('log', 'a').write(timestamp)
file('output', 'w').write(file('template').read() % locals())
nwords = sum([len(line.split()) for line in file('input')])
for line in file('input'):
print line[:79]
-- bjorn
More information about the Python-list
mailing list