Python Forum
Returned value not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returned value not defined
#3
The function returns something like that (17, 15, 25, 154, 2, 4, 6, 10). I don't think that this is something which can be easily interpreted say in two weeks. What order, what values etc.

To make things more readable you could return dictionary (as suggested by ichabod801) or namedtuple. Then you have labels associated to your values to comprehend their meaning (FYI: namedtuples from collections built-in module are lightweight, immutable and have nice clean syntax to access values, something like: monsterpower.bosslevel

I observed that you imported module inside the function. Is there particular reason to do so? If there is no such reason I suggest to stick to PEP8 - Imports:

Quote:Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Returned value not defined - by somerandomguy123 - Jul-05-2019, 12:56 AM
RE: Returned value not defined - by ichabod801 - Jul-05-2019, 01:06 AM
RE: Returned value not defined - by perfringo - Jul-05-2019, 07:02 AM

Forum Jump:

User Panel Messages

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