Peak rules example's simplification
Alexander Artemenko <[email protected]> Fri, 27 Feb 2009 06:13:33 +0300
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
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: [email protected]