[Twisted-Python] Re: [Twisted-commits] r22428 - Deprecation API for functions and methods.
george at ringdevelopment.com
Thu Jan 31 13:22:06 EST 2008
On Thu, 2008-01-31 at 16:11 +0000, glyph at divmod.com wrote:
> On 02:45 pm, exarkun at divmod.com wrote:
> >What's the right way to get a string describing a Version now? It's an
> >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?
> This collection is super ad-hoc. Let me try to express some of the
> requirements that lead to the current confusion:
> * Sometimes you want a string that is formatted for use at a REPL,
> which can be eval'd to give the user the idea that it is a structured
> object and how they can build something similar (repr())
> * sometimes you want something that's human-readable and expresses all
> the information available about the version (str()). The square
> brackets probably come from the fact that I was playing WoW at the time,
> and square brackets meant "this is a thing, not just something a guy
> said". I was thinking you'd want to see like [Twisted Epic Spaulders of
> the Owl] for the version number. (Maybe a bad call.)
> * Sometimes you want just the version number in canonical format
> (x.y.z+dev) not the name of the package (.short())
> * I hypothesize that sometimes you want to omit the +dev part because
> you're trying to fit into a stricter format, but I don't really remember
> why .base() exists.
> Was getVersionString added because the other string representations
> weren't "friendly" enough? I guess the 'rUnknown' makes them look a
> little gnarly, but I'd actually like to see the SVN revision in the
> cases where it's present; the right thing to do to make it friendly
> would be to fix the entries-file parser.
> Also, in any case, it should really be a method. There's no reason to
> have a free function defined right after a class whose only argument is
> a single instance of that class :).
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
More information about the Twisted-Python