stargeek
PHP news website logo.
home    PHP scripts    articles    seo tools    links    search    contact    shop    realtors


Python on Panther







Python on Panther

Python on Panther 04/09/2004 04:08 PM

Mac DevCenter has an interesting article on using Python with Panther (I wonder who’d win out of those two…), with particular focus on the CoreGraphics library of image manipulation tools. This is an interesting alternative to the PHP/ImageMagick combination which I currently employ on this site.




This is a GrokNews Entry: (what is grok?)





Similar Items

Python on Panther

Grok Headline matches for Python on Panther

Python and XML: XML Namespaces Support
in Python Tools, Part Two


Python and XML: XML Namespaces Support
in Python Tools, Part Two
05/13/2004 07:55 PM
In his latest Python and XML column, Uche Ogbuji continues his tour of XML namespaces support in Python tools, focusing this time on 4Suite.

Python and XML: XML Namespaces Support
in Python Tools, Part Three


Python and XML: XML Namespaces Support
in Python Tools, Part Three
06/30/2004 07:31 PM
In this month's Python and XML column Uche Ogbuji examines the namespace support in ElementTree, PyRXPU, and libxml.

Backporting from Python 2.3 to Python
2.2


Backporting from Python 2.3 to Python
2.2
06/08/2004 11:18 PM

We have a home-grown templating system at work, which I intend to dedicate an entry to some time in the future. We originally wrote it in Python 2.2, but upgraded to Python 2.3 a while ago and have since been evolving our code in that environment. Today I found a need to load the most recent version of our templating system on to a small, long neglected application that had been running the original version ever since it had enough features to be usable.

Unfortunately, this application was running on a server that only had Python 2.2. Installing Python 2.3 would have been somewhat more painful here than on other servers we run for reasons I won't go in to, so I decided to have a go at getting our current code to run under the older Python version.

In the end, I only had to make three minor changes, all at the top of the file in question.

  1. I added from __future__ import generators as the very first line of the file. We use generators (with the yield statement) in a few places - this feature was only properly added in Python 2.3, but was made available in Python 2.2 as a "future enhancement" through the aforementioned obscure import.

  2. I added True, False = 1, 0 on the next line down. Surprisingly, Python 2.2 had no support for a boolean type and instead used a test for non-zero instead. The above line defines constants that behave enough like Python 2.3's True and False to avoid any problems.

  3. I defined an enumerate function, which was introduced for real in Python 2.3. Here's the code I used:

    
    def enumerate(obj):
        for i, item in zip(range(len(obj)), obj):
            yield i, item 
    

All in all it only took around ten minutes to put the above together, after which the script worked just fine. It was interesting to see how our code had grown to rely on Python 2.3 features without us realising it.


Python-SIP 4.0.1


Python-SIP 4.0.1 07/06/2004 06:45 AM
A tool to generate Python bindings from C++ code.

Python 2.3.3


Python 2.3.3 12/30/2003 05:13 PM
A high-level scripting language.

MPY (MPi for pYthon)


MPY (MPi for pYthon) 06/26/2004 05:20 PM
MPY Version 0.1 Released

XML with Xen and with Python


XML with Xen and with Python 12/19/2004 03:53 PM
Here is a comment on the paper "Programming with Circles, Triangles and Rectangles" by Erik Meijer et al. Perhaps interesting for XML programmers.

PHP Everywhere: Python vs. PHP?


PHP Everywhere: Python vs. PHP? 03/30/2005 09:12 AM
From PHP Everywhere today:

Another look at PHP and Python


Another look at PHP and Python 02/10/2004 02:46 AM
Postscript: Some people have got the impression from this article that I am moving away from PHP. That is far from the truth. I will continue to use PHP extensively today, tomorrow and for the forseeable future.

I find Python harder than PHP.

It could be because we are programming multi-threaded networked servers in Python, and that could be inherently harder than coding dynamic web-sites. Another reason could be lack of familiarity with Python. For example, I couldn't find the equivalent of htmlspecialchars and other functions, so i had to roll my own.

Despite all these issues, we are continuing to develop this in Python because (AFAIK) PHP does not have stable networking frameworks.

So what do I like about Python?

- Neat Syntax

The use of indentation for compound statements discourages deep nesting, and thus more modular code.

- More Safety Checks

In PHP, when you search using a regular expression, an associative array is returned. In Python, a typed object, "match" is returned when a regular expression search is performed, and not a generic dictionary. You cannot perform arithmetic on strings, an explicit cast is required; neither can you concatenate numbers with strings, explicit typecasts are needed.

- Supports Multi-Threaded Apps

There exists a global lock in Python that prevents multi-threading from working effectively on multiple processors - nevertheless Python has reasonable thread support and allows me to develop reasonably responsive servers.

- Python's Compiler is Standard

Python has a standard compiler and byte-code format. There is no such standard in the PHP world, and most ISP's don't support Zend or Turck MMCache encoded PHP. Better still, a debugger is included in the package too.

- Python Fully Supports Unicode

Python 2.0 and later has full support for unicode. For example to convert big5 to unicode is the simple:

    unicode_str = unicode(tw_chinese_string, 'big5')

In contrast, see how complicated it is to perform double-byte to unicode conversions in PHP (see User Notes).

The only issue i had with the unicode support is that it doesn't come with a complete set of double-byte decoders (eg. big5, gb). After a 20 minute google search, i found this set of python cjk decoders.

And what I dislike about Python

- Python Is Not Rapid Enough?

I think that PHP is a better tool for rapid application development, especially for web-sites. Minor type issues are handled for you transparently in PHP. In Python, once a variable is set, stricter type-checking is performed on most operations.

So you can argue that Python is safer. But PHP coding is definitely more rapid.

Another thing i dislike is that Python's import/load facility does not check .py file modification dates. If i modify a .py file, Python's run-time environment will not recompile it until i restart Python, or perform a reload manually from the command-line interpreter.

- Database Access

Python does not have official database drivers, and you have to select and download these drivers yourself. It's easy to get it wrong. For example, only after coding the adodb_odbc module using PythonWin odbc extension did i realize how awful PythonWin odbc was. I then found the mxODBC extension - unfortunately the mxODBC requires commercial licensing ($75 per CPU).

- Python is Not That Popular

Popularity is relative. There are lots of Python programmers - but there are perhaps 3 times more PHP programmers than Python ones. In Malaysia, the ratio of PHP to Python programmers is probably much worse (10:1?). And there are many training centers offering PHP courses. AFAIK, there are no centers in Malaysia offering Python training. A quick search in monster.com reveals the following (numbers might change over time):

PHP: 131 jobs
http://jobsearch.monster.com/jobsearch.asp?q=php&re=0&sort=rv&tm=&fn=6 60&vw=b&cy=US&brd=1%2C1862%2C1863

Python: 41 jobs
http://jobsearch.monster.com/jobsearch.asp?q=python&re=0&sort=rv&t m=&fn=660&vw=b&cy=US&brd=1%2C1862%2C1863


Python 2.3


Python 2.3 10/28/2003 11:06 PM
Python 2.3 was released yesterday... and not a moment too soon. I was just swearing under my breath about this sort of nonsense:
>>> cosmos = technorati.cosmos('http://diveintomark.org/')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "technorati.py", line 214, in cosmos
    xmldoc = minidom.parseString(rawdata)
  File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py", 
    line 1605, in parseString
    return expatbuilder.parseString(string)
, in parseString
    return builder.parseString(string)
  File
"/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", 
    line 187, in parseString
    parser = self.getParser()
  File
"/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", 
    line 119, in getParser
    self._parser = self.createParser()
  File
"/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", 
    line 734, in createParser
    parser.namespace_prefixes = True
AttributeError: namespace_prefixes
OS X users, don't be discouraged by the mention of there being no MacPython version yet or daunted by the task of compiling it from source -- MacP ython 2.3 lives and is just a few glorious GUI installer clicks away.

Python-SIP 4.0


Python-SIP 4.0 06/23/2004 12:48 PM
A tool to generate Python bindings from C++ code.

Python-SIP 3.9


Python-SIP 3.9 12/08/2003 04:42 PM
A tool to generate Python bindings from C++ code.

Python-SIP 4.1.1


Python-SIP 4.1.1 09/24/2004 03:30 PM
A tool to generate Python bindings from C++ code.

Possible windows+python bug


Possible windows+python bug 03/22/2005 05:13 PM
liquid_at_cyberspace.org (Mar 22 2005)

Python X Library


Python X Library 01/27/2004 11:33 AM
Maintainer wanted

Writev for Python 0.0.3


Writev for Python 0.0.3 12/27/2004 03:22 PM
A Python module that provides access to the POSIX writev call.

Optimising Python


Optimising Python 10/29/2003 12:12 AM

Some great tips for optimising Python, courtesy of Ian Bicking:


Python SOAP


Python SOAP 12/02/2003 02:41 PM
Transition to sourceforge.net

Re: Possible windows+python bug


Re: Possible windows+python bug 03/22/2005 06:53 PM
azurIt (Mar 22 2005)

Acme-Python-0.01


Acme-Python-0.01 04/05/2005 04:53 PM

X Python Newsreader 0.3.0


X Python Newsreader 0.3.0 06/18/2004 02:27 PM
An online newsreader with Unicode support.

python-gammu 0.4


python-gammu 0.4 01/22/2004 08:38 AM
Python bindings for Gammu.

Pynfo - Python IRC bot


Pynfo - Python IRC bot 08/08/2004 07:05 PM
Pynfo Unmaintained

Still having Python trouble


Still having Python trouble 12/04/2002 10:25 PM
Narrowed the problem down to httplib parsing responses from IIS. For some screwy reason, IIS returns two HTTP status messages:...

ADOdb for Python


ADOdb for Python 01/26/2004 10:15 AM
In my work with Python, I found that there's no good database abstraction library, so I wrote my own. Looks familiar, doesn't it?

PHP Python
include "adodb.inc.php";
$conn = NewADOConnection('mysql');
$conn->Connect('server','user','pwd','db');
$rs = $conn->Execute('select * from tab);

while (!$rs->EOF) { print_r($rs->fields); $rs->MoveNext(); } $rs->Close(); $conn->Close();

import adodb_mysql;
conn = adodb_mysql.adodb_mysql()
conn.Connect('server','user','pwd','db')
cursor = conn.Execute('select * from tab)

while not cursor.EOF: print cursor.fields cursor.MoveNext()

cursor.Close() conn.Close()

It also supports the iterator protocol:

  cursor = conn.Execute('select * from table')
  for row in cursor:
       print row

Python does have the DB API, but it's similar to ODBC in that it provides a very minimal layer, without abstracting SELECT ... LIMIT, LOBs, string quoting, etc. Download zip.

I will try to post a comparison between developing in Python and PHP when I have more time.


Python-LDAP 2.0.1


Python-LDAP 2.0.1 06/30/2004 01:11 AM
LDAP modules for Python development/deployment.

Python milter 0.6.9


Python milter 0.6.9 04/20/2004 07:39 PM
A Python binding for the sendmail milter API with a sample milter.

Python-Bytecode-2.4


Python-Bytecode-2.4 07/12/2004 05:30 PM

[USN-73-1] Python vulnerability


[USN-73-1] Python vulnerability 02/05/2005 09:38 PM
Martin Pitt (Feb 03 2005)

Python para .NET


Python para .NET 07/30/2004 12:24 PM

Python milter 0.7.0


Python milter 0.7.0 08/03/2004 04:22 PM
A Python binding for the sendmail milter API with a sample milter.

Python vs Parrot


Python vs Parrot 12/17/2004 06:34 PM
In many ways, it seems like Python and Parrot are from different planets. In Python, the general approach seems to be to reduce everything possible to a canonical form as early as possible, and then deal with everything consistently. In Parrot, the general approach seems to be to leave everything in its original form as long as possible, and then deal with everything separately. ...

Python on the 6600


Python on the 6600 03/06/2004 01:56 AM

I just saw python running on the Nokia 6600. Soo cool. I can't wait to get my hands on it. You may have heard, but python is coming first, not perl. My next python script will be a bot from my phone.


Numerical Python


Numerical Python 09/16/2004 09:33 AM
numarray-1.1 released

"the Python Paradox"


"the Python Paradox" 08/13/2004 03:28 AM

Dive Into Python


Dive Into Python 09/08/2004 02:50 PM

Python SRS Library 0.30.9


Python SRS Library 0.30.9 08/31/2004 02:50 AM
A Python Sender Rewriting Scheme library.

Python IRC library 0.4.1


Python IRC library 0.4.1 10/30/2003 04:58 AM
A Python IRC library.

Inline-Python-0.21


Inline-Python-0.21 07/27/2004 05:44 AM

Grok Description matches for Python on Panther
GrokA matches for Python on Panther

gun-thumbnail


gun-thumbnail 05/23/2004 05:00 AM
hauntingly beautiful pictures of an abandoned island off of japan .. click here for the images .. SAIGA Yuji

ne.jp/asahi/saiga/yuji/gallary/gunsu/thumbnail.html
track this site | 4 links


"gun-thumbnail"


"gun-thumbnail" 05/24/2004 11:09 AM

Tk-Thumbnail-1.2


Tk-Thumbnail-1.2 01/22/2004 02:10 AM

Image-Thumbnail-0.5


Image-Thumbnail-0.5 04/17/2005 10:59 AM

Image-GD-Thumbnail-0.04


Image-GD-Thumbnail-0.04 04/17/2005 10:59 AM

Creating Thumbnail using GD Library


Creating Thumbnail using GD Library 10/29/2003 12:11 AM
This tutorial would help you to create thumbnail images using the GD library.

Express Thumbnail Creator v1.7


Express Thumbnail Creator v1.7 10/31/2003 09:37 PM
Use Express Thumbnail Creator to create HTML image galleries with thumbnails. The program has a wizard-style interface with a wide range of options. [Shareware $40.00 1.70 MB]

Image-Magick-Thumbnail-0.04


Image-Magick-Thumbnail-0.04 04/17/2005 10:59 AM

Image-Magick-Thumbnail-Fixed-0.02


Image-Magick-Thumbnail-Fixed-0.02 09/01/2004 12:11 AM

Image-Magick-Thumbnail-Fixed-0.03


Image-Magick-Thumbnail-Fixed-0.03 09/25/2004 05:35 PM

ThumbView - Expansive Thumbnail support!


ThumbView - Expansive Thumbnail support! 04/17/2005 09:02 PM
It's (still) alive!

Image-Magick-Thumbnail-Fixed-0.01


Image-Magick-Thumbnail-Fixed-0.01 08/19/2004 12:25 AM

GalleryListing.com Join Our XXX
Thumbnail Achives


GalleryListing.com Join Our XXX
Thumbnail Achives
05/03/2004 07:25 PM
19:58 GalleryListing.com Join Our XX

gallerylisting.com/join.html
track this site | 4 links


Picture Rescue adds thumbnail previews,
more


Picture Rescue adds thumbnail previews,
more
09/02/2004 12:18 PM
Prosoft Engineering has released Picture Rescue 1.1, an update of the US$59.95 tool for recovering pictures from corrupt or reformatted media cards or pictures that have been deleted from the media card...

Prevent Windows from Creating the
Thumbnail Cache (thumbs.db)


Prevent Windows from Creating the
Thumbnail Cache (thumbs.db)
06/19/2004 03:07 PM
Tech-Recipes Jun 19 2004 6:10PM GMT

10.3: Drag images directly from
Preview's thumbnail drawer


10.3: Drag images directly from
Preview's thumbnail drawer
12/03/2003 11:02 AM
In Panther's Preview App, you can drag images from the side drawer and drop onto Apps, Dock icons and other windows, folders, the desktop. Anything you can do with the original file. This is useful for checking a CD or folder...

BetterSearch, Firefox plugin that adds
thumbnail website previews for many
sites


BetterSearch, Firefox plugin that adds
thumbnail website previews for many
sites
02/07/2005 01:27 AM
BetterSearch

bettersearch.g-blog.net
track this site | 4 links


Python on Panther

The following phrases have been identified by the grok system as matching this entry: web thumbnail python coregraphics

















Also check out: