merits of Lisp vs Python
greg
greg at cosc.canterbury.ac.nz
Mon Dec 18 23:01:23 EST 2006
More information about the Python-list mailing list
Mon Dec 18 23:01:23 EST 2006
- Previous message (by thread): merits of Lisp vs Python
- Next message (by thread): merits of Lisp vs Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bill Atkins wrote:
> This is not a response to any particular post, but rather to the
> general argument that macros are not as useful as we Lispers claim.
>
> Here is a fairly complete GUI RSS reader in 90 lines of Lisp
For comparison, here's how something with a similar
API might be used from Python.
class RSSInterface(Interface):
def __init__(self):
Interface.__init__(self,
panes = [
TextInput('url_pane',
title = 'Feed URL:',
callback = 'add_feed',
callback_type = 'interface'),
PushButton('add',
text = 'Add Feed',
callback = 'add_feed',
callback_type = 'interface'),
PushButton('refresh',
text = 'Refresh All',
callback = 'refresh_feeds',
callback_type = 'interface'),
PushButton('delete',
text = 'Delete Feed',
callback = 'delete_feed',
callback_type = 'interface'),
TreeView('tree',
visible_min_width = ('character', 84),
visible_min_height = ('character', 40),
action_callback = 'browse_item',
callback_type = 'item_interface',
expandp_function = lambda: True, # not sure how best to translate
children_function = 'tree_item_children',
print_function = 'tree_item_string')
],
layouts = [
ColumnLayout('main', ('top', 'tree')),
RowLayout('top', ('url_pane', 'add', 'refresh', 'delete'))
],
title = 'Barebones RSS Reader v1.0')
self.channels = [
parse_rss_from_url(url) for url in [
'http://planet.lisp.org/rss20.xml',
'http://feeds.theonion.com/theonion/daily']]
def add_feed(self):
...
def delete_feed(self):
...
# etc.
--
Greg
- Previous message (by thread): merits of Lisp vs Python
- Next message (by thread): merits of Lisp vs Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list