Python Forum
function defs in decision code body
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function defs in decision code body
#1
i have been putting many function defs in decision bodies yo decide which version of a function to define. most cases involve testing the python version and defining function code specific for that version. the reason i do this is to reduce the version testing runtime cost, to do it when functions are being defined instead of each time the function is called. i consider it reasonable optimization (as opposed to some of the crazy hacks i've done in C and assembler to squeeze every cycle out of the CPU). i've also done things like decision code based on environment variables like my debug assistance functions that can be enabled (defined to do a specific help like finding and printing a variable) or disabled (defined to just return).

so i am wanting to get critical opinions about doing this kind of thing.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
function defs in decision code body - by Skaperen - Nov-24-2018, 05:26 AM

Forum Jump:

User Panel Messages

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