[Pythonmac-SIG] Re: Pythonmac-SIG Digest, Vol 23, Issue 42

2005-03-26 Thread Jon Schull
MacEnthon 0.0 Prerelease

This looks great.
Have you considered adding vpython to this package?  It uses numarray, plays well with ipython, and is of unsurpassed simplicity and elegance.

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


[Pythonmac-SIG] plistservices 3 is available

2005-03-26 Thread Sarwat Khan
I've released plistservices v3 at http://sarwat.net/opensource/
The main feature it adds is that it indents the XML output as 
CoreFoundation does. I think the only difference in the output is that 
CF will put newlines at well-placed spots in the CFData objects, and I 
didn't want to bother.

=> This point is the end of the useful part of this message.
The reason why it took so long to do indenting was a matter of 
principle. I was sick of the thought of doing yet another 
XML/HTML-output chunk of code that passes a stupid indent param along 
the recursion. At this point, it's been 2+ years since I've had to do 
that, so it doesn't have the same sting anymore (I am noticing however, 
that the more I think about the fact that I did it, the more it bugs 
me). Also, I found myself not wanting to use plistservices for some 
things because of the fugly XML it produced.

This is actually version 4. Version 3 has been sitting on my computers 
since 2003, and apparently I forgot to release it. Back then I modified 
it so it was a nice replacement for mx.DateTime in MySQLdb's times.py. 
That was back when MySQLdb was at version 0.94; MySQLdb was then 
assuming Python 2.2, which doesn't have the datetime module.

The fact that I didn't put newlines in CFData XML is starting to gnaw 
at my brain. We'll see what happens.

Anyway, enjoy.
Sarwat.
{sarwat khan : http://sarwat.net}
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] plistservices 3 is available

2005-03-26 Thread Bob Ippolito
On Mar 26, 2005, at 10:48 PM, Sarwat Khan wrote:
I've released plistservices v3 at http://sarwat.net/opensource/
The main feature it adds is that it indents the XML output as  
CoreFoundation does. I think the only difference in the output is  
that CF will put newlines at well-placed spots in the CFData  
objects, and I didn't want to bother.
Since we fixed the bugs in plistlib w.r.t. date/time stuff before the  
release of Python 2.4, is there any particularly good reason to use  
plistservices instead of the updated plistlib?

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


Re: [Pythonmac-SIG] plistservices 3 is available

2005-03-26 Thread Sarwat Khan
Since we fixed the bugs in plistlib w.r.t. date/time stuff before the 
release of Python 2.4, is there any particularly good reason to use 
plistservices instead of the updated plistlib?
Well, there is the fact that you have to go to 
http://sarwat.net/opensource/ to get it. Is that a good reason? :)

The most useful part is the classes it contains and the programming 
interface that mimics Cocoa. When I'm using  plists I often want to 
manipulate dates the same way I do in Cocoa/CF (datetime et al can be 
annoying). plistservices has the following classes with the following 
methods,

class Data:
dataWithContentsOfFile
dataWithOpenFile
dataWithString

writeToFile
description - CF style description
bytes   - raw str
class Date (datetime.datetime):
	timeIntervalSince1970		-- and vica versa
	timeIntervalSinceReferenceDate	-- and vv
	dateFromStandard8601String	- gives you a datetime from an 8601 string; 
useful with MySQL and the like.

class EasternTimeZone (datetime.tzinfo):
Fixed offset in minutes east of UTC
class TimeInterval (datetime.timedelta):
	duration - in seconds, same as NSTimeInterval
	durationForTimeDelta, a class method for getting the seconds of any 
timedelta object.

	timeIntervalFromStandard8601TimeString(self, string) from 
__builtin__.type
 |  mx.DateTime compatibility method.
 |
 |  Given an iso 8601 time string (HH:MM:SS.FF), returns a 
timeInterval
 |  compatible with mx.DateTime.ISO.ParseTimeDelta. This means 
that
 |  you can also add a - in front of the value to create a 
negative
 |  time delta.
	(hey, copy & paste is a good idea)

timeIntervalWithTimeDelta, a TimeInterval from a timedelta.
And then there's two module functions, dataFromPropertyList and 
propertyListFromData, which do what NSPropertyListSerialization does.

{sarwat khan : http://sarwat.net}
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] plistservices 3 is available

2005-03-26 Thread Bob Ippolito
On Mar 26, 2005, at 11:33 PM, Sarwat Khan wrote:

Since we fixed the bugs in plistlib w.r.t. date/time stuff before  
the release of Python 2.4, is there any particularly good reason  
to use plistservices instead of the updated plistlib?


Well, there is the fact that you have to go to http://sarwat.net/ 
opensource/ to get it. Is that a good reason? :)

Unfortunately most people would rather pick something up from the  
standard library if it works :)


The most useful part is the classes it contains and the programming  
interface that mimics Cocoa. When I'm using  plists I often want to  
manipulate dates the same way I do in Cocoa/CF (datetime et al can  
be annoying). plistservices has the following classes with the  
following methods,

class Data:
dataWithContentsOfFile
dataWithOpenFile
dataWithString
Which are inconsistent with PyObjC, because the number of arguments  
does not equal the number of underscores!

So now there are three ways to do it:
1) Use plistlib, which comes with Python anyway, and has a pythonic  
API (at the expense of having to download it if you're not on a Mac)
2) Use PyObjC, and get the real APIs (at the expense of losing cross- 
plat support and requiring an extension, but guaranteed compatibility  
and speed)
3) Use plistservices, and get something that is similar to the real  
APIs, but mapped in a somewhat ambiguous way, that is different from  
the PyObjC mapping.

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


Re: [Pythonmac-SIG] plistservices 3 is available

2005-03-26 Thread Sarwat Khan
On 26-Mar-05, at 8:43 PM, Bob Ippolito wrote:
Which are inconsistent with PyObjC, because the number of arguments 
does not equal the number of underscores!
Who wants to write code like that :P You're either using PyObjC or not.
So now there are three ways to do it:
1) Use plistlib, which comes with Python anyway, and has a pythonic 
API (at the expense of having to download it if you're not on a Mac)
2) Use PyObjC, and get the real APIs (at the expense of losing 
cross-plat support and requiring an extension, but guaranteed 
compatibility and speed)
3) Use plistservices, and get something that is similar to the real 
APIs, but mapped in a somewhat ambiguous way, that is different from 
the PyObjC mapping.
My use of plists are either on a Mac or on a web server. In the second 
case, #1 and #2 are out (at any rate, it's easier to download 
plistservices than it is to get the Python's source and extract 
plistlib). plistlib doesn't make available its ISO 8601 parsing 
available either. The mapping isn't ambiguous, it's the same as the 
Java bridge.

{sarwat khan : http://sarwat.net}
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] plistservices 3 is available

2005-03-26 Thread Bob Ippolito
On Mar 27, 2005, at 12:02 AM, Sarwat Khan wrote:
On 26-Mar-05, at 8:43 PM, Bob Ippolito wrote:

Which are inconsistent with PyObjC, because the number of  
arguments does not equal the number of underscores!

Who wants to write code like that :P You're either using PyObjC or  
not.
It would be more useful if it had the same API as the actual classes  
as you would use them from PyObjC.  Then you could just drop it in  
when you need cross-platform code.

So now there are three ways to do it:
1) Use plistlib, which comes with Python anyway, and has a  
pythonic API (at the expense of having to download it if you're  
not on a Mac)
2) Use PyObjC, and get the real APIs (at the expense of losing  
cross-plat support and requiring an extension, but guaranteed  
compatibility and speed)
3) Use plistservices, and get something that is similar to the  
real APIs, but mapped in a somewhat ambiguous way, that is  
different from the PyObjC mapping.

My use of plists are either on a Mac or on a web server. In the  
second case, #1 and #2 are out (at any rate, it's easier to  
download plistservices than it is to get the Python's source and  
extract plistlib). plistlib doesn't make available its ISO 8601  
parsing available either. The mapping isn't ambiguous, it's the  
same as the Java bridge.
It's not that hard to get the plistlib from Python's source.
"doesn't make available its ISO 8601" parsing doesn't really sound  
like a feature to me.  It doesn't make its base64 decoding either :)   
If the feature was compelling enough to make available, it should be  
in a "date/time parsing" module, not in a mostly unrelated module  
that just so happens to need it.

You mean, the same as the Java bridge, where every selector is mapped  
by a human manually, and is probably *already* unmaintained and dying?

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