[Twisted-Python] Re: [Twisted-commits] r22428 - Deprecation API for functions and methods.

Jean-Paul Calderone exarkun at divmod.com
Thu Jan 31 09:45:56 EST 2008


On Wed, 30 Jan 2008 18:51:09 -0700, Jonathan Lange <jml at wolfwood.twistedmatrix.com> wrote:
>
> [snip]
>
>Modified: trunk/twisted/python/versions.py
>==============================================================================
>--- trunk/twisted/python/versions.py	(original)
>+++ trunk/twisted/python/versions.py	Wed Jan 30 18:51:07 2008
>@@ -122,3 +122,14 @@
>         if ver is None:
>             return ''
>         return ' (SVN r%s)' % (ver,)
>+
>+
>+
>+def getVersionString(version):
>+    """
>+    Get a friendly string for the given version object.
>+
>+    @param version: A L{Version} object.
>+    @return: A string containing the package and short version number.
>+    """
>+    return '%s %s' % (version.package, version.short())

What's the right way to get a string describing a Version now?  It's an even
harder decision to make than it was before.  Is it:

  * str(Version(...))
  * repr(Version(...))
  * Version(...).base()
  * Version(...).short()
  * getVersionString(Version(...))

Can we do something to make this better?

Jean-Paul




More information about the Twisted-Python mailing list