[Tutor] 2 problems in a small script

Dick Moores rdm at rcblue.com
Mon Oct 15 23:17:20 CEST 2007


At 04:36 AM 10/15/2007, Kent Johnson wrote:
>Dick Moores wrote:
>
>>>If your interested, this could be done succinctly with set types. 
>>>(no iterating required!)
>
>>Done. I had no idea set could be used that way! With a couple of 
>>modifications, I used your ideas in both <buggy_For_Web5b.py> and 
>><getCrew_ForWeb2.py> (see the thread I started, < 
>>http://www.nabble.com/An-idea-for-a-script-tf4603558.html#a13149808 >).
>
>You might as well create the set of disallowed letters just once:
>astr = set(ascii_letters + digits + '-_')

Kent, do you mean that in 
<http://www.rcblue.com/Python/buggy_For_Web5b.py> every time 
well_formed() is used it recreates set(astr) (but not the string 
astr)? I think you do, but I'd like to make sure..

Thanks,

Dick




More information about the Tutor mailing list