pyobjc / pyobjc-framework-Cocoa / Doc / api-notes-kvo.txt

Key-Value Observing and Python
==============================

Key-Value Coding and Key-Value Observing are supported by PyObjC. Key-Value
Observing is only supported for Cocoa objects though, because it is technically 
impossible to generate the right events for pure python objects (such as 
``dict`` or ``list`` instances)[1].

* _[1]: at least not without patching the Python interpreter itself.

PyObjC will automaticly call ``willChangeValueForKey:`` and 
``didChangeValueForKey:`` when changing the attribute of an object that is
a subclass of ``NSObject``. It is therefore not necessary to call those 
methods in most use-cases for Key-Value Observing.

.. warning::

   The 'change' dictionary for ``observeValueForKeyPath:ofObject:change:context:``
   can be changed after the method call, don't store a reference to this dictionary
   but make a copy when you want to use its contents later on.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.