Python Forum
want better option name for a conversion function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
want better option name for a conversion function
#1
i have a function that converts ints to strings, given the int value, the sequence of digits to convert with, the minimum width of the result, the prefix to pad the result with if it is shorter than the minimum width. the name "digits" for the sequence of digits to convert with, just doesn't seem quite right to me. is there a better name i can use? the len() of this string will be the default base, and the maximum base if the caller specifies a base.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Hello Skaperen, variable names can be any combination of characters, it is good practice to use names that imply their content, making the program easier to read and understand. digitsis preferable to use the field name for the corresponding variable, than a name consisting of a single letter such as a or b or any random name that does not reflect the actual content of the variable such as Value.
Reply
#3
but what name would describe in a meanigful way? to make it is understood, this is the string that the conversion gets digits from,indexed by the digit value. something not too long is preferred.
Tradition is peer pressure from dead people

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


Forum Jump:

User Panel Messages

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