[Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

12
Cocoa and the Python/C API You got some python in my objective-c! This work is under the public domain , except for whatever parts are explicitly mentioned as released under some more constrictive license (boo). --Rory Geoghegan [email protected]

description

Talk by Rory Geoghegan given at October's Python Ireland meetup at Seagrass. More info - http://www.python.ie/meetup/2009/oct_talks__seagrass/

Transcript of [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Page 1: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Cocoa and the Python/C APIYou got some python in my objective-c!

This work is under the public domain, except for whatever parts are explicitly mentioned as released under some more constrictive license (boo).

--Rory [email protected]

Page 2: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

WhooshIt’s fast!

Icon acquired from the Whoosh Project

Page 3: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

CocoaOooh, pretty

Page 4: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

PyObjCDon’t hurt me crazy dog/snake monster

Icon acquired from the PyObjC project

Page 5: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

O RLY?

Image:O RLY? by mmechtley. Some rights reserved.

Page 6: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Get your cocoa on

Page 7: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

PYTHON_HOME & PYTHON_PATHvirtualenv for teh win!

Image:Bristol Museum Vs. Banksy, by JasonBlait. Some rights reserved.

Page 8: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Our FatherPy_Initialize

PyRun_SimpleFile

PyImport_AddModule

PyModule_GetDict

Py_Finalize

Image:Baird's Rat Snake in mid-shed by mcwetboy. Some rights reserved.

Page 9: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Py_Object *It slices, it dices, it even juliennes!

Image:NASCAR Duct Tape, in association with 3M, by sneakums. Some rights reserved

Page 10: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Py_INCREF & Py_DECREFMemory leaks! Hooray!

Image:Abacus, by Generation X-Ray. Some rights reserved.

Page 11: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Message passing in ObjCIf it talks like a duck, walks like a duck, sounds like a duck...

Image:Baby Duck, by ViaMoi. Some rights reserved.

Page 12: [Python Ireland] Cocoa and the Python/C API by Rory Geoghegan

Bundles & resources[[[NSBundle mainBundle] pathForResource:@"schema"