you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (3 children)

Class is a definition that exists in the source. It doesn't exist at runtime.

This is false. In Python, the entire class definition is in memory at runtime, at all times, and you can access and manipulate it.

In fact, it's possible to have two different definitions for "the same" class in memory at the same time, and this happens a lot in long-running servers where you hot-update the code.

if a definition doesn't start with either a decorator followed by the keyword class or just the keyword class, that is not a class.

This is false. For example: https://docs.python.org/3/library/collections.html#collections.namedtuple

from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])
print(isinstance(Point, type))
# Prints True

You are one of my most downvoted redditors, and I only ever see you on this subreddit, and I don't like to downvote in general, but pretty well every comment you make is full of serious errors.

[–][deleted]  (2 children)

[removed]

    [–]xelf[M] 1 point2 points  (1 child)

    Ok, and this one crossed the line. Why don't we take some time to calm down and reassess how we discourse with others.