This post originated from an RSS feed registered with Python Buzz
by Hans Nowak.
Original Post: A dead simple options system
Feed Title: Efectos Especiales
Feed URL: http://www.zephyrfalcon.org/weblog2/rss.xml
Feed Description: Ramblings, rants, musings, ideas and observations. Topics include (but are not limited to): programming (especially Python), books, games (especially CCGs and board games), astrology, design, writing, painting, etc.
I added a new options system to Charm. It's easy and powerful. Here's how it works: 1. Write a file options.py: class Options: def __init__(self, **kwargs): self.extend(**kwargs) def extend(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) options = Options() # some example default values options.width = 80 options.title = "My title" # etc... ... [313 words]