Stupid question, just need a quick and dirty fix

Jordan Bayless jmbayless at gmail.com
Fri Jul 22 01:26:25 EDT 2016


No, I tried using a bunch of elif statements earlier and when I added more than around 3 of them it threw errors. I just assumed that was some kind of limit. We both agree that's piss-poor, lazy coding. I'm just trying to find something that works though. To this point, everything I try fails.

I added your code and now it's telling me my variable isn't defined. 

good_ids = {
    2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 24, 25, 26, 27, 28, 31, 34, 35, 36, 37,
    38, 39, 40, 45, 50, 51, 53, 55, 56, 57, 59, 62, 65, 68, 71, 76, 78, 80,
    82, 83, 87, 88, 89, 91, 93, 94, 96, 97, 101, 103, 105, 106, 107, 109,
    110, 112, 113, 115, 122, 124, 125, 126, 130, 131, 132, 134, 135, 136,
    137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151
}

desired = Id < 10 or Id > 133 or Id in good_ids

When I try to validate whether I passed that check, I'm told there's a Name error and it's not defined (using the last line of the snippet above).

Also, I guess I'm at a loss for what I'm supposed to do with "desired" to check it prior to running my email code. 

if desired == True: doesn't work 

I'm headed to bed. Too tired to focus on making this work and I apparently really don't 'get' what I'm doing. Maybe I'll be better off with fresh eyes on it tomorrow.



More information about the Python-list mailing list