Noah Gift over on O’Reilly OnLamp Blog has an article on building a greedy coin changer. That is, given a value, say 71 cents, calculate the fewest coins needed to make the amount. He had listed a number of solutions, but I felt I could do it a bit more pythonic. ;)

#!/usr/bin/env python
"""implement a greedy coin changer, returning the
fewest coins to make the change requested."""
#coin_list can be expanded to include silver dollars
# and 50 cent pieces by just expanding the coin list
# to [100,50,25,10,5,1] the reulting answer
#structure will modify itself to reflect 

coin_list = [25,10,5,1]
change_requested = .71
remaining = change_requested * 100
change_returned = []    #result structure

for coin in coin_list:
    num_coins,remaining =  divmod(remaining,coin)
    change_returned.append(int(num_coins))

print change_returned
print remaining

The benefits of this version, are no conditional logic is needed, the coin structure can be modified and the answer will modify itself accordingly.

 

Now this is truly an interesting development. Google’s just announced App Engine is sure to super-charge the Python community and convert a number of disillusioned developers of other languages in to Pythonistas. There have been lots of interesting comments floating in the blogosphere about what this could mean.

I think it is a great opportunity on a smaller scale than anyone might imagine. Sure, this could serve as the platform for the next YouTube type social-2.x site, but what I think this really means, is that Google is rounding out the Google Apps for Domains by giving the ability to create something more than a brochure-ware style site offered by their current Sites for Google Apps.

Many are looking for Google to use this as an opportunity to expand advertising revenue, and that is certainly possible for widely popular webX.x sites but what they really needed is another tool/knife to hold to the competition’s throats. Looking at the tea leaves in the bottom of my glass, I see something more akin to a SharePoint attack; Going after the S in SMB market.

App Engine allows for authenticating users via Google system, how much longer until we can interact with other Google services in a similar fashion?? Calendaring, GTalk, etc — I’m not talking mashups, something much more refined.

 

There is a great article over on SnapLogic,  SnapLogic Blog Squishy design with Python: Designing in code

The gist of the article is that when developing APIs are never as complete as we want them when we are developing a new system and if you are using a static language you’ve got lots of ramifications to consider and code to rework when you have to expand an API.  However, dynamic languages have a real advantage here and they go on to give a very real example and how they dealt with it.

 

There is an interesting write up on plugin architecture – g :: A Simple Plugin Framework

A project that I’m working on is going to require a plugin framework for a number of things: Logic, Data Storage, Reporting and I’ve been keeping my eyes open for papers/articles on plugin frameworks.  Do you know of any resources/articles?

© 2012 In Re: Suffusion theme by Sayontan Sinha
Stop SOPA