Expression problem.

Chris Rebert clp2 at rebertia.com
Wed Oct 6 04:59:00 EDT 2010


On Wed, Oct 6, 2010 at 1:32 AM, Nethirlon . <nethirlon at gmail.com> wrote:
> Hi,
>
> I am having trouble with an expression.
>
> I have the following line of code:
>
> self.failUnless(c.as == 65215)
>
> What happens when you compile this is that you get a syntax error.
> This is because as has been made a keyword. failUnless is from the
> module unittest.
>
> Now my problem is this. the ".as" is no where defined in the code. The
> code builds just fine if you removed it. But the origigal programmer
> must have put it in for a reason. I just cant understand what that is.
>
> Can anyone point me into the right direction? was ".as" before it
> became a keyword some kind of string manipulator?

Nope, it was just normal attribute syntax. I would assume the original
author just named some object attribute "as" for whatever reason, but
the fact that removing it doesn't cause a test failure is just
bizarre. Perhaps you should examine the code for c's class (and/or its
ancestors)? (Sounds like you might have already done that though, in
which case: o_O *shrug*)

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list