1

A colleague of mine has defined a class with a method print. It is called as instance.print() to dump some text to stdout (it pretty much just wraps print()).

I feel like this is bad practice and want to suggest we refactor this but I can't think of any good reasons to justify this either.

jamylak
  • 128,818
  • 30
  • 231
  • 230
deed02392
  • 4,799
  • 2
  • 31
  • 48

1 Answers1

0

Yes it is bad practice. All of these decisions are very subjective and can be interpreted differently therefore I suggest reading the official PEP8 style guide. You can even include it with your editor to suggest changes!

Another massive reason why this is really bad practice is; while it works in Python3 as expected, in Python2 print was a name which precludes you from using it as an identifier, including a method name.

Oyster773
  • 375
  • 1
  • 10