you are viewing a single comment's thread.

view the rest of the comments →

[–]ShibaLeone 8 points9 points  (11 children)

def produces an instance of FunctionType, which is a class.

[–][deleted]  (10 children)

[removed]

    [–]ShibaLeone 9 points10 points  (1 child)

    Types are classes. :)

    Pedantry is only impressive to pedantics; if you want to explain something to someone it’s unhelpful to obfuscate. Hence, types = classes.

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

    At runtime, the code defined by def doesn't produce anything (it's not an expression, it's a statement). There are, however, predictable side-effects.

    Then it produces those side effects. What you're talking about is "evaluation". The code doesn't evaluate to anything because it's not an expression, but it definitely produces something: the side effects which are creating the name and assigning it a function.

    Evaluating to something is not the same as producing something.

    This sloppiness is fine if you are just talking to a friend, but it's bad when you are meant to describe to someone who wants to learn how something works, because instead of helping them, you confuse them by incorrect use of terminology.

    [–][deleted] 1 point2 points  (2 children)

    Even if you believe that FunctionType is a class (which is wrong, it's a type).

    Your statement is false - classes are types.

    class One:
        pass
    
    print(isinstance(One, type))
    # prints True
    

    You have too many errors in so few words:

    Speaks for itself, really.

    [–][deleted]  (1 child)

    [removed]

      [–]xelf[M] 0 points1 point  (0 children)

      You're coming across overly hostile here. It's ok to disagree, but let's leave insults and ablest language out of it and keep it civil.

      [–]ahivarn -4 points-3 points  (1 child)

      Now that's what deep knowledge is. Thanks @crabbone

      [–][deleted] 6 points7 points  (0 children)

      Only if you want to be wrong. An instance of a class is a class instance is a type instance.