api stability
John A Meinel
john at arbash-meinel.com
Tue Dec 20 05:15:15 GMT 2005
Aaron Bentley wrote:
> Robert Collins wrote:
> | __foo -> private to me
> | _foo -> private to me and subclasses
> | foo -> public.
> |
> | Note that _foo is therefor a public symbol if the class is public.
>
> I don't understand this logic. If _foo is private to me and subclasses,
> why would it also be public?
>
> Wherever I've used _foo, I've intended to warn users that foo was not
> guaranteed to be supported, but use it if you must.
>
> Aaron
Specifically we have classes like InventoryEntry which has:
class InventoryEntry:
def check(*args):
# setup some stuff for child classes
return self._check(*args)
If someone implements a child of InventoryEntry, they must override
self._check(*args). It is not meant to be public outside of Inventory,
but it is meant to be accessed inside the class hierarchy.
I think a bare "def _foo()" (not part of a class) would always be private.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051219/8b1dbcb3/attachment.pgp
More information about the bazaar
mailing list