def attrnum(self, attr):
if attr < <NUM_LIT:0>:<EOL><INDENT>return len(self.attrs) + attr<EOL><DEDENT>elif isinstance(attr, str):<EOL><INDENT>return self.attrnames.index(attr)<EOL><DEDENT>else:<EOL><INDENT>return attr<EOL><DEDENT>
Returns the number used for attr, which can be a name, or -n .. n-1.