0

Ideally function shouldn't be lengthy, but if multiple task require same inputs from users, is it okay to hv lengthy function?

15th Oct 2018, 8:11 PM
Bishu Giri
Bishu Giri - avatar
8 Réponses
+ 6
you can keep passing the same input through the functions I guess. here's a silly example: info=input() def doThing(info): return str(info) def doOtherThing(info): print(info) info=doThing(info) doOtherThing(info) Edit: if you got a bunch of notifications, there was a troll/spammer here that I got in a conversation with. They are gone now and I deleted everything.
15th Oct 2018, 8:59 PM
Ahri Fox
Ahri Fox - avatar
+ 3
Beside what Ahri Fox said, its ok have lengthy functions while they are not composed by codes that can be modularized (eg. they can be used outside function context) else its better (eg its not mandatory but help) create multiple functions P.S. @Ahri Fox Thank you 😉
15th Oct 2018, 9:37 PM
KrOW
KrOW - avatar
+ 1
Sometimes when you have a lengthy function, you can delegate further and call other functions from within, using the original arguments.
16th Oct 2018, 2:20 PM
HonFu
HonFu - avatar