[MERGE] Allow parent_providers to not have a get_parents attribute.

Aaron Bentley aaron at aaronbentley.com
Thu Jan 10 23:27:41 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> On Thu, 2008-01-10 at 17:52 -0500, Aaron Bentley wrote:
>> ParentProviders are a private API and we can freely remove anything we
>> like from them.  But Graph is not a private API, and it provides a
>> get_parents method.

> Graph does /not/ provide a get_parents
> method. Graph *uses* the get_parents method on the object its composed
> with.

It does indeed provide a get_parents method.  It just doesn't implement it.

- From a caller's perspective, I don't seen any difference between

class Graph(object):

    __init__(self, pp):
        self.get_parents = pp.get_parents

and

class Graph(object):

    __init__(self, pp):
        self._pp = pp

    def get_parents(*args, **kwargs):
        return self._pp.get_parents(*args, **kwargs)

The former just saves a function call.

>> You can't just set the method to None some of the time.

> I had been following suit with the previous API break (requiring
> get_parents_map). I think, given that we have an API break but only
> in .dev, that I'll do a full deprecation patch.

If Graph.get_parents were not public, that would be one thing.  But no
one expects a public callable to sometimes be None.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHhqnt0F+nu1YWqI0RAky5AJ9UDjlNz4mwOla1YM4C37uULv65ZgCeOZi+
tOOBMPj83kSRQf21GT+kio4=
=ss9l
-----END PGP SIGNATURE-----



More information about the bazaar mailing list