Skip to content
Prev 304465 / 398506 Next

don't print object attributes

On Wed, Aug 29, 2012 at 4:23 AM, Liviu Andronic <landronimirc at gmail.com> wrote:
I'd say no: firstly, print() is incredibly generic (type
methods(print) in a typical session) and gets called at every top
level eval so you  don't really want to add any overhead / complexity
to it. But more than that, and to Duncan's point, this is a hack:
attributes are usually used to define classes (not rigorously for S3,
but in practice) and allowing the user to turn some of them off is
likely to break some of the downstream print methods for little
perceptible gain. Attributes are there for good reason, I'm not sure
why you think they should be generally ignored.

That said, if you define print like that locally, it should mask
base::print just as well as changing base::print would.

Cheers,
Michael