At 07:08 PM 1/30/2010 -0500, Barry Warsaw wrote:
On Jan 29, 2010, at 11:03 PM, Tarek Ziadé wrote:>Yes, that's how Jinja does already for example, using Setuptools's >pkg_resources : > >__version__ = __import__('pkg_resources').get_distribution('Jinja2').version And that's different yet again from what PJE suggests.
Not really; just a different way of spelling the same thing. In either case, you're looking at the .version attribute of the Distribution instance.
This is screaming for a blessed API to be pushed into the stdlib. (BTW, why use __import__() there?)
It lets you save an extra line to import pkg_resources; that's really the only difference.
_______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
