I usually prefer:
`return cls.COMMENT if line.startswith('#') else cls.CODE` and you can even make this a lambda.

But I think you would prefer the more verbose (and readable?) version.