Logo

Question preview

But when do it run?

What this preview is

About this preview

But when do it run? is a medium quant interview question on language knowledge in Python.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

What this Python execution-order question tests

This is a medium-difficulty question that probes your understanding of Python's runtime behaviour, particularly how the language handles initialization, method resolution, and side effects during class and instance setup. It's the kind of question that separates candidates who have memorized syntax from those who understand the execution model.

To answer correctly, you need to trace the order in which Python evaluates decorators, class definitions, method calls, and instance creation. The question rewards careful reading of code flow and awareness of when different statements actually execute—skills essential for debugging subtle bugs in production systems and for reasoning about code that uses metaprogramming or complex initialization patterns.

  • Class definition and namespace creation
  • Decorator application order
  • Method binding and descriptor protocol
  • Instance initialization with __init__