Do other Python GUI toolkits require this?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sat Apr 21 16:22:55 EDT 2007


Kevin Walzer a écrit :
>  From the introduction to PyObjC, the Python-Objective-C bridge on Mac 
> OS X:
> 
> "As described in Objective-C for PyObjC users the creation of 
> Objective-C objects is a two-stage process. To initialize objects, first 
> call a class method to allocate the memory (typically alloc), and then 
> call an initializer (typically starts with init). Some classes have 
> class methods which perform this behind the scenes, especially classes 
> that create cached, immutable, or singleton instances."
> 
> An example:
> 
> myObject = NSObject.alloc().init()
> 
> I know Tkinter doesn't require any manual memory allocation of this 
> sort. Does wxPython, PyQt, PyGtk require anything like this when 
> creating objects?
> 

PyObjC is not a GUI toolkit, it's a bridge between Python and 
Objective-C (a smalltalk-inspired OO superset of ansi C).

And FWIW, under the hood, Python also uses this 2-stages 
instanciation/initialisation scheme (methods __new__ and __init__), even 
if it doesn't requires you to call them both explicitly.



More information about the Python-list mailing list