Stupid question, just need a quick and dirty fix

Jordan Bayless jmbayless at gmail.com
Fri Jul 22 00:39:22 EDT 2016


On Thursday, July 21, 2016 at 11:28:55 PM UTC-5, Chris Angelico wrote:
> On Fri, Jul 22, 2016 at 2:19 PM, Jordan Bayless <jmbayless at gmail.com> wrote:
> > I get various errors no matter what I do to this to try and make it work. Variable not defined. Referenced before assignment. etc etc. I'm lost. How do I make it work?
> 
> It might be easier if you post all your code. To be honest, what I'd
> be looking at is something like this:
> 
> good_ids = {
>     12, 15, 24,
>     ...  # fill in all of these
> }
> desired = id < 10 or id > 133 or id in good_ids
> 
> But it's possible your problem has nothing to do with your massive
> 'if' tree and everything to do with indentation or other problems we
> can't see.
> 
> ChrisA

Posting the entire code snippet is tough because it's thousands of lines of code. Basically, I'm inside of a For loop already. The code worked when I got it, but I'm trying to tap into it and extend it outward to notify me via email in certain circumstances. I got it to send the email, but it seems there's a) no case statement (WTF?) and b) I'm limited to how many elif statements I can use. Again, I don't particularly care how elegant this is because it's ultimately getting disposed of sooner rather than later..I just want it to work.

Let me review my code and see if I can pare it down to the essentials so I can give a better idea of what I'm doing.



More information about the Python-list mailing list