Alex Martelli wrote: >> As others have mentioned, your particular instance is probably >> evidence that you need to restructure your code a little bit, but I >> do agree that "x = y; if x: ..." is a common enough idiom that it >> warrants a shortcut. And reusing "as", I think, is nice and readable, >> and it's an advantage that it doesn't require adding any new keywords >> or symbols. > > Actually, I agree with you. Unfortunately, I doubt python-dev will, > but the chance is good enough that it's probably worth proposing there > (ideally together with a patch to implement it, just to avoid any > [otherwise likely] whines about this being difficult to implement:-).
This was proposed on python-dev (or maybe it was python-ideas) - I think the discussion died out though without any resolution. You should check the archives to see if there was a resolution on it, and if not I'd suggest putting a PEP together, rather than just raising it again. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list