sl33k_ wrote:
What are wrappers?

 What entities do they wrap around?

Struggling to understand the concept.
We would need a little bit of a context to answer that question, you could be refering to differents things.

I'll give it a try on one common usage for wrapper:

A wrapper is a python module that interface between python and a 3rd party library offering a non python interface.

Consider Google chart api.

This is the native URL API:
https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World


pygooglechart is the python wrapper for that api, allowing you to get the same effect, using Python objects:

from pygooglechart import PieChart3D
# Create a chart object of 250x100 pixels
chart = PieChart3D(250, 100)
# Add some data
chart.add_data([20, 10])
# Assign the labels to the pie data
chart.set_pie_labels(['Hello', 'World'])
# Print the chart URL
print chart.get_url()

Python wrapper allows users to write only python code, even when calling non python 3rd libraries.

Another example of wrapper is pgdb. It allows you to interface with a postgreSQL database without knowing about the native interface, you can commit and fetch data from the database by writing python code only. Nice !

JM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to