This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pje
Recipients daniel.urban, lukasz.langa, ncoghlan, pitrou, pje, python-dev
Date 2013-05-25.19:02:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
Antoine Pitrou added the comment:
> -1. Exposing a function allows to modify the underlying implementation
> without breaking any API.

This doesn't make any sense.  Once you've exposed an API that gives
out a value for this, you can't change the implementation in a way
that doesn't involve handing out a value... in which case you can just
as easily set it as an attribute.

So there is actually zero improvement in encapsulation: it's purely a
ritualistic wrapping, like Java programmers insisting on having
getFoo() methods in Python when an attribute would suffice.  If there
must be a way to change it later to be dynamic, it can always be
exposed as an attribute of an object that could grow a property later,

    from abc import object_graph

    if object_graph.version != old_version:

Nick Coghlan added the comment:
> Trading correctness for speed is almost never a good idea.

How is "correctness" relevant to the question of whether a readable
value is exposed as an attribute or a method?
Date User Action Args
2013-05-25 19:02:55pjesetrecipients: + pje, ncoghlan, pitrou, daniel.urban, lukasz.langa, python-dev
2013-05-25 19:02:55pjelinkissue16832 messages
2013-05-25 19:02:54pjecreate