Python Forum
Functions: why use a variable "display" in a UDF as a Boolean
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions: why use a variable "display" in a UDF as a Boolean
#4
A function should return a value or print something, without returning anything.
If both is the case, your function has unwanted side effects.
Maybe the author of this function knows this and introduced the ability not to print, if the function is used.

But still, it's annoying if a function prints something, if you expect just a return value.
Sometime libraries are using excessive logging functions, which is also annoying, if activated by default. Then you've to deactivate this manually, if you do not want to have debug output in your program. Most people do not want this.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
RE: Functions: why use a variable "display" in a UDF as a Boolean - by DeaD_EyE - May-26-2025, 05:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling functions by making part of their name with variable crouzilles 4 2,017 Nov-02-2023, 12:25 PM
Last Post: noisefloor
  How to display <IPython.core.display.HTML object>? pythopen 3 51,301 May-06-2023, 08:14 AM
Last Post: pramod08728
  Whys is asterisk and random variable necessary in these functions? rrowhe4d 5 2,786 Aug-05-2022, 07:53 AM
Last Post: Gribouillis
  Store variable data and display sum after 60 seconds the_dude 11 5,938 Dec-16-2021, 07:07 PM
Last Post: deanhystad
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 3,211 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  Display Globar Variable N0m1t 1 2,264 Mar-19-2019, 10:29 PM
Last Post: metulburr
  How do you make functions that take a variable that is not defined? magic 6 6,123 Sep-24-2018, 01:30 PM
Last Post: gruntfutuk
  Boolean: if variable is capitalized Truman 9 19,413 Jan-09-2018, 11:04 PM
Last Post: Gribouillis
  Returning a Boolean operator and a variable both? PythonAndArduino 2 3,685 Nov-08-2017, 08:31 PM
Last Post: PythonAndArduino

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020