Re: [Pyobjc-dev] Namespaces, intended behavior?
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2018-04-05 16:13:07
|
> On 5 Apr 2018, at 17:39, Just van Rossum <jus...@gm...> wrote: > > Hi, > > I am wondering, is the following intended behavior? > > ------------- > import Foundation > > class TestMyCustomObject(Foundation.NSObject): > pass > > import AppKit > # it's suddenly available via AppKit: > print(AppKit.TestMyCustomObject) > # even via import *: > from AppKit import * > print(TestMyCustomObject) > ------------- > > Thanks, That is expected behavior and is a side effect of lazy loading of frameworks. In the past I have attempted to expose only the classes that belong in a framework (by exposing only those classes located in the correct framework bundle), but that code turned out to be too slow (because the Cocoa method I used for that is slow), so that got dropped a long time ago. When I started on the lazy loader I didn’t even try to make it guess whether or not a class should be loadable through the current framework wrapper. This is not ideal, but good enough. Ronald |