deprecating parameters

Robert Collins robertc at robertcollins.net
Sun Jan 15 20:46:19 GMT 2006


So, for symbol versioning in the branch-formats branch I needed to mark
Branch(..., init=XXX) as deprecated.

I've used the follow for now:

    def __init__(self, transport, init=deprecated_nonce,
                 relax_version_check=False):
....

        if deprecated_passed(init):
            warn("BzrBranch.__init__(..., init=XXX): The init parameter
is "
                 "deprecated. Please use Branch.initialize().",
                 DeprecationWarning)


deprecated_nonce is a marker used by deprecated_passed - its assumed
noone will ever deliberately pass deprecated_none into a routine (and if
they do, their problem). (Its an object instance, theres no way to
accidentally do this).


I took this route because I was not sure how to make a -nice- parameter
deprecation decorator at this point - but I'm adding a TODO to research
that later.

Does this sound reasonable to folk ?

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060116/39ef36cf/attachment.pgp 


More information about the bazaar mailing list