5 Blog Entries tagged: python


Pygmalion - Python Interface to Ma.gnolia

  • October 18th, 2006 (1 year, 8 months ago)

This is very cool...

>>> import pygmalion
>>> dir(pygmalion)
['Exceptions', 'Handlers', 'Pygmalion', 'Types', '__builtins__', '__doc__', '__file__', '__name__', '__path__']
>>> pyg = pygmalion.Pygmalion('your API key here')
>>> dir(pyg)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'apikey', 'bookmarks_add', 'bookmarks_delete', 'bookmarks_find', 'bookmarks_get', 'bookmarks_tags_add', 'bookmarks_tags_delete', 'bookmarks_tags_replace', 'bookmarks_update', 'headers', 'tags_find']
>>> bookmarks = pyg.bookmarks_find(person='robhudson')
>>> b = bookmarks[0]
>>> b
<Bookmark: Pygmalion (http://code.google.com/p/pygmalion/)>
>>> dir(b)
['Tags', '__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'created', 'description', 'id', 'owner', 'private', 'rating', 'screenshot_url', 'tags', 'title', 'updated', 'url']
>>> b.title ...

Read the rest »

About this entry

Date Posted:
October 18th 2006 at 11:10:00 PM

Tagged:
python


Javascript becoming more Pythonic?

  • August 17th, 2006 (1 year, 10 months ago)

http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7

Javascript is picking up Iterators and Generators (with the yield keyword). And array comprehensions! Does this look familiar?

var ten_squares = [i * i for (i in range(0, 10))];

I wish browsers would simply open it up to allow:

<script type="text/python" src="mypython.py" />

Most graphical toolkits have APIs for many languages, why not the browser?

But I like seeing that Javascript is seemingly becoming more Pythonic.

Read the rest »

About this entry

Date Posted:
August 17th 2006 at 1:08:00 PM

Tagged:
python


Apple releases Python based calendar server

  • August 10th, 2006 (1 year, 10 months ago)

During the WWDC Apple announced a number of open source projects. One interesting project for Python was the release of the iCal Server which is Python based. It uses the Twisted networking framework as its server component and all the other bits are Python. It implements CalDAV. The source page is here: http://trac.macosforge.org/projects/collaboration.

Read the rest »

About this entry

Date Posted:
August 10th 2006 at 8:08:00 AM

Tagged:
python


PyNewbie on making cryptograms

  • July 18th, 2003 (4 years, 11 months ago)

I used to enjoy cryptograms a lot and wanted to generate some on my own. I originally wrote a script to do this in Perl. While learning Python, I rewrote it and learned a few things about the string library in the process. Here goes...

import sys, string, random

We're going to be using sys to catch arguments passed to our script, or to catch input from a pipe. We've got lots of string manipulation so we're importing the string module. The random module will give us a way to shuffle a list so we can match ...

Read the rest »

About this entry

Date Posted:
July 18th 2003 at 12:07:00 PM

Tagged:
python


PyNewbie on Using Sockets in Python

  • July 13th, 2003 (4 years, 11 months ago)

A socket is a connection from one program to another. The two programs are typically on different machines, but they can also be on the same machine. Most sockets are from a client program connect to a server program to get some sort of information. Most socket transmissions are bi-directional -- send a request, receive some information. When you request a web page from within a web browser, you are causing the initiation of a socket connect from your computer (the client) to the web server's computer (the server, which could also be located on the same machine). You request ...

Read the rest »

About this entry

Date Posted:
July 13th 2003 at 12:07:00 PM

Tagged:
python