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

Post on 19-May-2015

972 views 2 download

Tags:

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

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 Geogheganr.geoghegan@gmail.com

WhooshIt’s fast!

Icon acquired from the Whoosh Project

CocoaOooh, pretty

PyObjCDon’t hurt me crazy dog/snake monster

Icon acquired from the PyObjC project

O RLY?

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

Get your cocoa on

PYTHON_HOME & PYTHON_PATHvirtualenv for teh win!

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

Our FatherPy_Initialize

PyRun_SimpleFile

PyImport_AddModule

PyModule_GetDict

Py_Finalize

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

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

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

Py_INCREF & Py_DECREFMemory leaks! Hooray!

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

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.

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