Re: [Pythonmac-SIG] Python 2.3+Py23Compat/Python 2.4 compatibility problem

2005-05-04 Thread Bob Ippolito

On May 4, 2005, at 6:13 PM, has wrote:

> Bob wrote:
>
>
>>> I figured that, but I'd rather hoped a more elegant solution  
>>> might be forthcoming at source. Is there a good reason why they  
>>> couldn't both agree on a common location, or at least provide the  
>>> relevant aliases in 2.4 to preserve Python's much-vaunted  
>>> backwards compatibility?
>>>
>>
>> This is *FORWARDS* compatibility, not backwards.  Forwards  
>> compatibility is always messy.
>
> Touché. ;)
>
>> 1) Work around it
>>
>
> On my todo list. (Requiring 2.4 isn't an option as casual Python  
> users are more likely to be using the stock 2.3.5 and won't want to  
> upgrade just on my account.)
>
> Still, can't blame my hoping there might've been a better  
> solution... language warts are always unhappy things, Python warts  
> doubly so. Pity Apple decided to stuff Python.framework into / 
> System instead of /Library, otherwise having Py23Compat install  
> into plat-mac/Carbon might not have been out of the question. I  
> don't suppose Apple would be interested in including these modules  
> (in the correct location) in future Tiger updates...?

Apple did everything the right way.  Why on earth should they put  
System stuff anywhere but? ... and god I hope they don't start  
mangling their Python 2.3 distribution *mid-release* to look Python  
2.4-ish.

This problem wouldn't have existed if these modules weren't part of  
the standard library and/or they weren't part of the Carbon  
namespace.  Ripping them out or replacing them altogether with  
something generated in a more modern way is probably the right thing  
to do, eventually, but so far nobody has cared enough to deal with it.

In any case, basically all Mac OS X APIs (LaunchServices included)  
are better wrapped with PyObjC.  The stuff in Carbon is either  
becoming deprecated or being wrapped by higher-level Objective-C or  
CoreFoundation-style APIs, both of which PyObjC is much more  
appropriate for.  It's really just a question of when PyObjC's header- 
parsing capabilities will be able to wrap CoreFoundation-style stuff  
quickly and correctly.

Fortunately Apple isn't shipping PyObjC with Mac OS X, so we actually  
have the opportunity to implement these things before they become  
frozen in time.

-bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python 2.3+Py23Compat/Python 2.4 compatibility problem

2005-05-04 Thread has
Bob wrote:

>>I figured that, but I'd rather hoped a more elegant solution might be 
>>forthcoming at source. Is there a good reason why they couldn't both agree on 
>>a common location, or at least provide the relevant aliases in 2.4 to 
>>preserve Python's much-vaunted backwards compatibility?
>
>This is *FORWARDS* compatibility, not backwards.  Forwards compatibility is 
>always messy.

Touché. ;)


>1) Work around it

On my todo list. (Requiring 2.4 isn't an option as casual Python users are more 
likely to be using the stock 2.3.5 and won't want to upgrade just on my 
account.)

Still, can't blame my hoping there might've been a better solution... language 
warts are always unhappy things, Python warts doubly so. Pity Apple decided to 
stuff Python.framework into /System instead of /Library, otherwise having 
Py23Compat install into plat-mac/Carbon might not have been out of the 
question. I don't suppose Apple would be interested in including these modules 
(in the correct location) in future Tiger updates...?

Cheers,

has
-- 
http://freespace.virgin.net/hamish.sanderson/
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python 2.3+Py23Compat/Python 2.4 compatibility problem

2005-05-04 Thread Bob Ippolito

On May 4, 2005, at 4:50 PM, has wrote:

> Bob wrote:
>
>
>>> Probably one for Bob, but there's an unpleasant disagreement  
>>> between Py23Compat and Python 2.4 [which] means scripts written  
>>> on Python 2.3 break on 2.4 and vice-versa when importing any of  
>>> these modules. What's the fix?
>>>
>>
>> This is not a bug,
>>
>
> Maybe not, but it's hardly good design either. Any time I wish for  
> gratuitous complexity or broken-by-design-ness I can easily use  
> Perl or AppleScript instead. :p
>
>> try:
>>from LaunchServices import Launch, LaunchServices
>> except ImportError:
>>from Carbon import Launch, LaunchServices
>>
>
> I figured that, but I'd rather hoped a more elegant solution might  
> be forthcoming at source. Is there a good reason why they couldn't  
> both agree on a common location, or at least provide the relevant  
> aliases in 2.4 to preserve Python's much-vaunted backwards  
> compatibility?

This is *FORWARDS* compatibility, not backwards.  Forwards  
compatibility is always messy.

You have three options:

1) Work around it
2) Require Python 2.4
3) Require the "non-standard-library" components even on 2.4

Pick one, there's nothing that can be done about it.

-bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python 2.3+Py23Compat/Python 2.4 compatibility problem

2005-05-04 Thread has
Bob wrote:

>>Probably one for Bob, but there's an unpleasant disagreement between 
>>Py23Compat and Python 2.4 [which] means scripts written on Python 2.3 break 
>>on 2.4 and vice-versa when importing any of these modules. What's the fix?
>
>This is not a bug,

Maybe not, but it's hardly good design either. Any time I wish for gratuitous 
complexity or broken-by-design-ness I can easily use Perl or AppleScript 
instead. :p


>try:
>from LaunchServices import Launch, LaunchServices
>except ImportError:
>from Carbon import Launch, LaunchServices

I figured that, but I'd rather hoped a more elegant solution might be 
forthcoming at source. Is there a good reason why they couldn't both agree on a 
common location, or at least provide the relevant aliases in 2.4 to preserve 
Python's much-vaunted backwards compatibility?

Cheers,

has
-- 
http://freespace.virgin.net/hamish.sanderson/
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Python 2.3+Py23Compat/Python 2.4 compatibility problem

2005-05-04 Thread Bob Ippolito

On May 4, 2005, at 3:21 PM, has wrote:

> Probably one for Bob, but there's an unpleasant disagreement  
> between Py23Compat and Python 2.4 on where the LaunchServices, OSA,  
> and other new 2.4 modules are located: the former installs them in  
> individual directories of the same name under site-packages, the  
> later keeps them at the top level of plat-mac/Carbon. This means  
> scripts written on Python 2.3 break on 2.4 and vice-versa when  
> importing any of these modules. What's the fix?

This is not a bug, you need to write your code such that it  
accommodates for both:

try:
 from LaunchServices import Launch, LaunchServices
except ImportError:
 from Carbon import Launch, LaunchServices

-bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Python 2.3+Py23Compat/Python 2.4 compatibility problem

2005-05-04 Thread has
Hi all,

Probably one for Bob, but there's an unpleasant disagreement between Py23Compat 
and Python 2.4 on where the LaunchServices, OSA, and other new 2.4 modules are 
located: the former installs them in individual directories of the same name 
under site-packages, the later keeps them at the top level of plat-mac/Carbon. 
This means scripts written on Python 2.3 break on 2.4 and vice-versa when 
importing any of these modules. What's the fix?

has
-- 
http://freespace.virgin.net/hamish.sanderson/
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig