[Tutor] Input
Ricardo Aráoz
ricaraoz at gmail.com
Wed Jan 16 10:20:26 CET 2008
Kent Johnson wrote:
> Ricardo Aráoz wrote:
>
>> _validChars = {
>> 'X' :
>> 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
>> , '9' : '1234567890'
>> , '-' : '-1234567890'
>> , 'A' :
>> 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
>> , '!' : 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}
>> _validKeys = _validChars.keys()
>
> <snip>
>> while maskChar not in _validKeys :
>
> There is no need to make _validKeys, you can write
> while maskChar not in _validChars
> which is actually more efficient, in general, because it is a hash table
> lookup instead of searching a list.
>
> Kent
>
Thanks Kent, I'll wait to see if there are more corrections and re-post
the corrected code.
More information about the Tutor
mailing list