Recursive algorithms anyone?
Stepan Koltsov
yozh at niit.ru
Wed Jun 13 02:24:34 EDT 2001
Nick Perkins <nperkins7 at home.com> wrote:
...skipped
> from __future__ import nested_scopes
> def additem(k,L):
> def _additem(x):
> if type(x) is type([]) : return map (_additem,x)
> else : return x+k
> return _additem(L)
IMHO more proper is
import types
...
type( x ) is types.ListType
because less operations performed (e. g. creating new list)...
--
mailto:yozh at mx1.ru
ICQ:26521795
http://www.mx1.ru/
... Они жили долго и счастливо и надоели друг другу в один день...
More information about the Python-list
mailing list