Newbie question...

shindich at my-deja.com shindich at my-deja.com
Thu Sep 28 18:38:22 EDT 2000


In article <mailman.970145388.3252.python-list at python.org>,
  =?iso-8859-1?Q?Max_M=F8ller_Rasmussen?= <maxm at normik.dk> wrote:
> From: shindich at my-deja.com [mailto:shindich at my-deja.com]
>
> >Huh? Since when do you need to write separate functions for adding
> >numbers and strings in Python? The buty of the language is that you
can
> >write template-like function easily.
> >The following function will do the job:
>
> Shure can, but I was not trying to write clever code, I was trying to
teach
> a lesson.
>
> My experience from my teaching days has shown me that I don't come
across
> more clearly by showing the answer as a more complicated example than
the
> one the student allready had trouble understanding.
>
> If somebody has trouble understanding a problem, split it up in more
simple
> subproblems, don't show what can be done if you allready understand
the
> problem.
>
> Lecturing'ly yours - Max M
>
>
I wasn't trying to write clever code either. If I were, I would have
written something like:
>>> def foo (**args): return reduce (lambda o1, o2: o1+o2, args.values
())
>>> foo (ugly='1', bad='2')
'21'


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list