[Tutor] Comparative code questions: Python vs. Rebol

antonmuhin на rambler.ru antonmuhin на rambler.ru
Thu Jan 16 05:14:04 2003


Hello, Tim!

There is another approach that seems not to be mentioned yet. It might
be a little bit closer to Rebol (actually, it's rather Lisp-ish):

PythonWin 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (mhammond@skippinet.com.au) - see 'Help/About PythonWin' for further copyright information.

>>> def H(level):
...     return lambda x: "<H%d>" % level + x + "</H%d>" % level
... 
>>> h1 = H(1)
>>> h1("string")
'<H1>string</H1>'
>>> h2 = H(2)
>>> h2("another string")
'<H2>another string</H2>'

HTH,
Anton.