[PEAK] Peak rules example's simplification

Alexander Artemenko svetlyak.40wt at gmail.com
Thu Feb 26 22:13:33 EST 2009


Hi All,

I found, that  example at http://pypi.python.org/pypi/PEAK-Rules/ page
can be simplified by omiting one part of the predicate in
pprint_long_list:

# Skip Skip
>>> @when(pprint, (list,))
... def pprint_list(lst):
...     print "pretty-printing a list"

>>> @when(pprint_list, "len(lst)>50") # Change 'pprint' to 'pprint_list' here and remove type check
... def pprint_long_list(lst):
...     print "pretty-printing a long list"

# Skip Skip

Is it feature or bug?
Which are the best practices in function extention, using Peak.Rules?

Thank you,
-- 
Alexander Artemenko (a.k.a. Svetlyak 40wt)
Blog: http://aartemenko.com
Photos: http://svetlyak.ru
Jabber: svetlyak.40wt at gmail.com


More information about the PEAK mailing list