Re: Feeling stupid..



Thanks!
As I suspected, I had good reason for feeling a little bit stupid.. :o/
Shows how one can become blind for the obvious..

Also, what I meant with trivial, in Python (not a critique about
Prolog, just a mere observation ;o) :

def readAndCount(fd):
histo = dict()
for line in fd:
for token in line.split(' '):
histo[token] = not histo.get(token) and 1 or histo[token]
+1
return histo

def wc(filename):
return readAndCount(open(filename, "r"))

Regards//M

.



Relevant Pages

  • Re: Typed Parameters
    ... foofunc(FooClass foo, clever, smart, stupid) ... def cool ... args.shift.cool_string(self, *args) ... args.shift.cool_string_hash(str, self) ...
    (comp.lang.ruby)
  • Re: Dynamic use of property() fails
    ... probably doing something very stupid... ... After reading the how-to for ... descriptors at http://users.rcn.com/python/download/Descriptor.htm I ... def delete: raise AttributeError ...
    (comp.lang.python)
  • Re: Cheetah template driven object output? Pythonically?
    ... > This may be trivial or stupid or both, but does anyone have a recipe ... > for gracefully using Cheetah to generate a text representation of an ... > def set_state: ...
    (comp.lang.python)
  • Re: noob question Letters in words?
    ... smart users because of your stupid ones. ... def make_menu: ... Returns the _index_ of the word entered, counting from zero. ...
    (comp.lang.python)
  • Re: (no) fast boolean evaluation ? missing NOT
    ... def Some_Function: ... print 'Ive been here', const ... and indeed I must have something very stupid!! ... Stef Mientki ...
    (comp.lang.python)