re.search when used within an if/else fails

Chris Angelico rosuav at gmail.com
Thu Nov 22 06:00:46 CET 2012


On Thu, Nov 22, 2012 at 3:41 AM, Kevin T <kevinintx at gmail.com> wrote:
> I went back and tried version a again, blam it is/does work now ?!?!?
> I am not sure what changed but version a was the original code that
> wouldn't work.  All the examples i had read, showed version a as a
> working version.  I spent significant time trying version a with
> parens, spacing changes, different regex values to no avail.  hence
> the creation of all the other versions.

This is why the Short, Self-Contained, Correct Example is so
important. See http://sscce.org/ for some info on that. I often find
myself stuck, begin typing up a post to some appropriate mailing list,
and while coalescing the problem into its smallest possible form, end
up finding the cause directly. More often than not, I end up
discarding the message unsent (though sometimes, I end up submitting a
patch to the language/library maintainers, eg improving the docs so
it's more visible next time). In any case, if you can copy and paste
the exact code and error, it's a lot easier for us to replicate your
problem.

ChrisA


More information about the Python-list mailing list