[Tutor] Alphabet lookup table
Phil
phillor9 at gmail.com
Fri Jan 28 19:44:42 EST 2022
On 28/1/22 21:00, Alan Gauld via Tutor wrote:
>
> BTW A class with only one method is a code smell. It means you
> don't really need a class, you only need a data structure and
> a function.
Your reply, Alan, initially caused me some confusion. My initial thought
was along the lines of c struct but Python only has classes and not
structures, as far as I know. However, after a night's sleep I now see
what you mean. Is this what you had in mind?
import alphabet
print(alphabet.alpha_table['P'])
alphabet.py contains just the dictionary lookup table.
--
Regards,
Phil
More information about the Tutor
mailing list