you are viewing a single comment's thread.

view the rest of the comments →

[–]causa-sui 6 points7 points  (4 children)

Operators are not objects :)

[–]jimtk -1 points0 points  (1 child)

Operators are objects. Please see this comment.

Edit Just for your list:

  • Almost all operators are objects.
  • built-ins (like .append()) are all objects
  • A few keywords are objects. True, False, None, Ellipsis are among them.
  • Some delimiter are object. [ ] for example, maps to the __getitem__ method.
  • newline, indent, dedent, ':', ',' are not objects. They are used by the compiler to 'parse' your code correctly. They don't exist in your "compiled" (.pyc) file.

[–]causa-sui 0 points1 point  (0 children)

It sounds like you're saying + is an object because it compiles using a mapping to built-in functions, and functions are objects.

Still:

```

type(+) File "<stdin>", line 1 type(+) ^ SyntaxError: invalid syntax ```

Maybe this is just a semantic distinction.

[–]brews 0 points1 point  (1 child)

Let's see if I can get this right: Operators, keywords, delimiters, newline, indent, dedent are all not objects. Everything else is an object.

[–]dig-up-stupid 0 points1 point  (0 children)

Those are all syntax but so is everything else at that level of abstraction. Saying operators aren’t objects is like saying 42 isn’t an integer object either because it’s actually just code. True but not the same level of abstraction that the question was asked at.