Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python metaclasses

Name: Anonymous 2010-08-08 0:23

               ____
  m n _∩      /∵∴∵∴\      ∩_ n m
⊂二⌒___)     /∵∴∵∴∵∴\    (___⌒二⊃
   \∵∴\   /∵:(・)∴∴.(・)∵ |   /∴∵/
     \∵∴\  |∵∴/ ○\∵∴|  /∴∵/
      \∵∴\|∵ /三 | 三ヽ∵|/∴∵/
        \∵∴|∵.| __|__  |∵|∴∵/
         \∵\ |  ===   |/∵/         how do they work?
           \∵ \___/∵/
            |∴∵━○━∵∴|           ∩
            |∴/___\∴|           | ヽ
            |∴| \_/ .|∴|_______丿  )
            |∴\___/∴∵∴∵∴∵∴∵:|  (
           /∴∵∴∵∴∵∴∵∴∵∴∵∴∴: |   )
         /∴∵∴/ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄` -´
        /∴∵∴/
       (∴∵∴ (
        \∵∴∵\
         \∵∴∵\
           \∵∴∵|⌒ヽ
            \∵/   ノ
              | ̄  /
             ノ   /
            ⊂、_ノ                tanasinn

Name: Anonymous 2010-08-08 12:42

http://docs.python.org/3.1/reference/datamodel#customizing-class-creation

They quite simply allow you to intervene in the creation of the class itself, i.e. at the time of definition.  They also hold class methods for e.g. determining inheritance.
In short, they are classes for classes.

Most Python programmers will never write a metaclass in their lifetime, but they are useful when creating frameworks.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List