May 19, 2008 at 9:02 am · tags: Pinder Python
In this new release of my Campfire API, Pinder 0.6.5, I fixed some bugs and added the methods ping() and topic() (which matches change_topic()) to the Room objects.
There is by the way an incompatible change: I do not distribute anymore BeautifulSoup and httplib2 with the library.
Go take it!
May 7, 2008 at 2:05 pm · tags: pycon Python
I opened a Twitter account for the PyCon Italy conference. I will try to keep updated as soon as things come up and the conference starts on Friday.
http://twitter.com/pyconit
April 14, 2008 at 1:19 pm · tags: Django googleappengine Python
While I was boring myself to death last weekend and while everybody was talking about it I came up with a sample application.
Now I can talk about Google AppEngine as well
It is simply a pastebin using the DataStore API, the webapp framework, the Users API, pygments and Django templates.
It is heavily inspired by http://dpaste.com
http://share11.appspot.com
The great thing? It took me less than an afternoon (mostly reading the framework docs) and it is ~200 LOC. Even greater? One shell command to upload and deploy
April 9, 2008 at 9:10 pm · tags: pycon Python
We had to make some schedule updates for the conference.
The savory new flavor of Py2.6 and Py3.0 is the title of the second day’s keynote. Who’s the speaker? Raymond Hettinger
The talk about callbacks and Python patterns have been replaced by a talk about the now utterly famous Google AppEngine.
The speakers of the PyPy talk are Antonio Cuni and Samuele Pedroni.
The title of Stallman’s keynote is Free Software in ethics and in practice.
April 9, 2008 at 10:30 am · tags: pycon Python
UPDATE: Raymond Hettinger will hold the keynote of the second day!
PyCon Due is definitely taking shape.
The conference will take place on a three day span.
The first day venue (free of any kind of charge) will be Palazzo Vecchio, in Florence. The conference will be introduced by the spokeswoman of Arts of the city. The opening keynote will be given by Richard Stallman, a person who needs no introduction in the software world.
After that, which is definitely important, we plan to go out and eat all together at a restaurant. Social life is equally important
The actual conference will begin the next day, the 10th of May, divided in three parallels track: a tutorial track, an introduction one and one based on experiences and real life usage of the language.
We’ll have talks about Python for beginners, various incarnations of Python, Plone, information retrieval, PyQt, nginx and WSGI, Cython, advanced uses of Django, PyMaemo, Unicode, PyPy, Zope 3 and more on that day. There will be also a Skype sponsored talk about Skype4Py.
The second day will be full of talks about profiling and debugging, SQLAlchemy, Django again, callbacks and patterns, map sharing, concurrency, Twisted Matrix, IronPython, Ajax, compilers in Python, the Fedora Unified Network Controller, FlyPDF and component architectures and more.
As you can imagine will be a tough three days conference, one an Italian (Python) developer should not miss in my opinion.
A lot of well known speakers: Alex Martelli (another who needs no introduction), Federico di Gregorio (author of psycopg2), Arkadiusz Wahlig (author of Skype4Py), Manlio Perillo (of nginx’s mod_wsgi fame), Antonio Cuni (from the PyPy team), Giovanni Bajo (mantainer of PyInstaller and of GCC fame), Brian Fitzpatrick (Subversion anyone?), Menno Smits (from the Resolver Systems team), Michele Simionato (of metaclasses, decorators and mro fame) and more.
As part of the board of the conference I’m a little biased by I’m really looking forward for this one
See you there!
April 4, 2008 at 10:24 pm · tags: pycon Python
UPDATE: I forgot to say that there will be simultaneous translation for non-italian speakers and attendants.
PyCon Due Italy is coming, here the press release (in Italian):
Firenze, 27 Marzo 2008: Sono finalmente aperte le iscrizioni a PyCon Due, la seconda conferenza italiana dedicata al linguaggio di programmazione Python, che si terrà a Firenze il 9, 10 e 11 Maggio 2008.
Dopo il largo successo di pubblico e critica ottenuto da PyCon Uno l’anno scorso, l’Associazione di Promozione Sociale “Python Italia” organizza quest’anno un evento ancora più ambizioso. Sono attesi infatti più di 300 tra professionisti, studenti e ricercatori, per una tre giorni intensa di appuntamenti e interventi imperdibili.
L’evento di apertura si svolgerà Venerdì 9 Maggio alle ore 15:00 nel prestigioso Salone De’ Cinquecento in Palazzo Vecchio dove, dopo il saluto da parte di Lucia De Siervo (Assessore all’Informatizzazione del Comune di Firenze, che ha donato all’evento il suo Patrocinio), Richard Stallman (fondatore del movimento del Free Software, inventore della licenza GPL e ideatore del progetto GNU) terrà un keynote sul tema “Free Software e Free Ethics”. Questo evento di apertura è ad ingresso libero (fino ad esaurimento posti, ma con priorità a chi è registrato al PyCon).
In seguito, nelle giornate di Sabato 10 e Domenica 11, all’Auditorium Al Duomo, si terranno numerose conferenze dedicate al linguaggo Python, su tre track parallele. Parteciperanno speaker internazionali di fama mondiale come Alex Martelli, Samuele Pedroni, Brian Fitzpatrick, e molti altri. Sono previsti anche interventi dedicati a programmatori che si avvicinano al linguaggio per la prima volta.
Inoltre, sono previste sessioni speciali come la sessione di recruiting (dedicate ai programmatori in cerca di nuova occupazione, e alla quale parteciperanno le aziende con posizioni lavorative aperte), momenti di svago e relax serale, e l’estrazione di regali offerti dagli sponsor (che includono aziende di caratura internazionale come Skype e Google).
Per maggiori informazioni, potete visitare il sito Internet ufficiale dedicato all’evento. Registrandosi in anticipo, inoltre, sono previsti forti sconti sul biglietto d’ingresso.
If you are at least midly interested in the Python word, come!
March 24, 2008 at 4:42 pm · tags: HTTP Python REST
Dave Benjamin summarized on his blog 10 reasons why XML-RPC should be better than REST but I think he completely missed the point about REST APIs. Let’s see:
1 - Standard, cross-language, typeful serialization of data
REST is definitely standard and cross-language. Regarding serialization, you can transfer what you want where you want but if your goal is persisting to make a local resemblance of what you have remotely, I think that’s bad. What we, as developers, really care is having the possibility to use a service remotely with an eye on scalability and transparence. Hence, HTTP
2 - User-defined error codes and messages
Nobody forbids anyone to invent your own headers and place whatever meaning you want upon them. With HTTP you can surely do that. Even whole extensions have been written.
3 - “Boxcarring” of requests to reduce overhead
Box carring is not really an advantage, there are other ways to reduce overhead. See also 207 multi status
4 - Serialization of binary content
Who said REST protocols do not support binary data? You can send whatever you want from the client to server, place the right content type and you’re done. See also media resources in the Atom Publishing Protocol.
5 - Serialization of date-time values
Do I really have to answer that?
6 - Standardized parameter passing
And what if I want to pass a parameter that’s not on the list of the allowed types in the specification? Remember, SOAP has born also to address some of the limitations of XML-RPC.
7 - Introspection allowing for straightforward code generation
Let me say one thing once and for all. Code generation for this purposes is bad, and almost useless (if you are used to highly dynamic languages). Anyway, REST through hypertext is implicitly introspection enabled. Also, documentation of APIs is there for us
8 - High-level APIs for just about every language
I think there’s no need to say that each and every language has some sort of HTTP client.
9 - No manual parsing of XML, ever
This point does not really make sense to me. If one XML-RPC method does return XML as content, you have to parse it because is part of the application domain. The same for SOAP or REST. If, as Dave mentioned, the language has some sort of high-level API for the protocol you don’t have to parse what’s on the wire manually: no manual parsing of XML-RPC responses, or SOAP envelopes or HTTP responses.
10 - Only three lines to call a function in Python and several other languages
This is really pointless. Using a REST API from httplib2 or restclient has the same brevity.
I think Dave did not get REST at all, his conclusion speaks for him:
Not that the REST doesn’t have its benefits, but someone ought to be saying this. XML-RPC isn’t complicated like SOAP, it runs just about everywhere, and it lets you get on with your work rather than arguing about semicolons versus slashes or XML versus JSON or countless other things. Besides, when your goal is to support as many languages as possible, you want to minimize the amount of code you write for each language. As far as I’ve seen, nothing else accomplishes literally no-code binding like XML-RPC.
I suggest reading RESTful Web Services, it’s really a good book. I also suggest reading the last article wrote by Stefan Tilkov addressing the most popular REST doubts.
December 27, 2007 at 4:21 pm · tags: Python Python SVN
Here we are with another update from Python 2.x SVN.
Old disassembly:
0 BUILD_MAP 0
3 DUP_TOP
4 LOAD_CONST 1 (1)
7 ROT_TWO
8 LOAD_CONST 2 ('x')
11 STORE_SUBSCR
12 DUP_TOP
13 LOAD_CONST 3 (2)
16 ROT_TWO
17 LOAD_CONST 4 ('y')
20 STORE_SUBSCR
New disassembly:
0 BUILD_MAP 0
3 LOAD_CONST 1 (1)
6 LOAD_CONST 2 ('x')
9 STORE_MAP
10 LOAD_CONST 3 (2)
13 LOAD_CONST 4 ('y')
16 STORE_MAP
Another optimization has been added: BUILD_MAP now has a meaning. It’s the estimated size of the dictionary. Allows dictionaries to be pre-sized (upto 255 elements) saving time lost to re-sizes with their attendant mallocs and re-insertions. Has zero effect on small dictionaries (5 elements or fewer), a slight benefit for dicts upto 22 elements (because they had to resize once anyway), and more benefit for dicts upto 255 elements (saving multiple resizes during the build-up and reducing the number of collisions on the first insertions). Beyond 255 elements, there is no addional benefit.
Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for compatibility are available.
Added signal.set_wakeup_fd(). There is a correspondent C API as well: PySignal_SetWakeupFd.
Slightly change in __ hash __ behavior and rich comparison: __ hash __ can be inherited when one __ lt __, __ le __, __ gt __, __ ge __ are overridden, as long as __ eq __ and __ ne __ aren’t.
Improved performance of built-in any()/all() by avoiding PyIter_Next().
November 24, 2007 at 4:58 pm · tags: Python Python SVN
IT’s been definitely a while since my last update but having a new job changes a lot my schedule.
In the httplib module there was a bug in reading data from the stream. HTTPConnection hanged when reading too much data at once. This has been fixed closing the connection after reading the whole stream.
In the decimal module the tuple constructor is now less permissive. It allowed bad coefficient numbers, floats in the sign and other stuff which generated the wrong number or let the algorithms misbehave.
mmap() has a new offset parameter to map a window of a file.
named_tuple has been renamed to namedtuple.
The sum() builtin function has been optimized for integer and floats: it keeps temporary sums in C instead of new Python objects assuming operands are all of the same type. If not, goes back to the default routine.
os.environ.pop() and os.environ.clear() now call unsetenv() for a correct behavior.
Added support for FreeBSD 8.
Added mp4 to mimetypes.py.
Various fixes in the bsddb module (like bsddb.dbshelve using the highest pickle protocol and more).
Fixed marshal’s incorrect handling of subclasses of builtin types.
Added set/frozenset’s isdisjoint(): returns True if two sets have a null intersection.
Added getter, setter, deleter methods to properties that can be used as decorators to create fully-populated properties.
class C:
foo = property(doc=“hello”)
@foo.getter
def foo(self):
return self._foo
@foo.setter
def foo(self, value):
self._foo = abs(value)
@foo.deleter
def foo(self):
del self._foo
c = C()
assert C.foo.__doc__ == “hello”
assert not hasattr(c, “foo”)
c.foo = -42
assert c.foo == 42
del c.foo
assert not hasattr(c, “foo”)
Python 2.6a0 (trunk:59170M, Nov 24 2007, 15:06:35)
>>> a = “pippoplutarca”
>>> a.find(‘t’, None, None)
8
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
>>> a = “pippoplutarca”
>>> a.find(‘t’, None, None)
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method
Directories and zipfiles containing a _ main _.py file can now be directly executed by passing their name to the interpreter. The directory/zipfile is automatically inserted as the first entry in sys.path.
Abstract base classes have been backported to Python 2.6.
Python 2.6 is now compilable with Visual Studio 2008.
Major change in the internal structure of the Decimal number: now it does not store the mantissa as a tuple of numbers, but as a string. This avoids a lot of conversions, and achieves a speedup of 40%. The API remains intact.
October 13, 2007 at 1:10 pm · tags: Python Python SVN
decimal module:
- There’s a bunch of is_* methods (like is_signed()) in Decimal class returning a boolean value.
- Added an internal class to store the digits of log(10), so that they can be made available when necessary without recomputing.
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. Formerly, it raised an OverflowError. Now, automatically shifts from ints to longs.
itertools.count() is no longer bounded to LONG_MAX. Formerly, it raised an OverflowError. Now, automatically shifts from ints to longs.
collections module:
- NamedTuple became named_tuple.
- named_tuple field specification can be a string or a list of strings.
- _ _ asdict _ _() have been added to convert a named tuple instance to dict.
- Add maxlen support to deque().
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api.
Next entries »