"…mais ce serait peut-être l'une des plus grandes opportunités manquées de notre époque si le logiciel libre ne libérait rien d'autre que du code…"

Les nouvelles de python pour la semaine du 7 au 13 janvier 2008

Posted by patrick sur janvier 14, 2008

– Utilisation d’Automation dans .NET3 avec IronPython (« Another option would be to use the System.Windows.Automation library – new in .NET 3.0. It’s a lot easier to use than the native APIs when it works for you. This sample will print the titles of all the top-level windows.

jim1.pnghttp://ironpython-urls.blogspot.com/2008/01/ui-automation-on-fepy-blog.html (« à partir du courriel de Jim Hugunin: Jim Hugunin recently posted an example of using the .NET 3.0 UI Automation API from IronPython (code ci-dessus) . This library hasn’t yet been implemented for Mono, so Seon Sanghyeon has written two blog entries on using an equivalent, « Assistive Technology Service Provider Interface », with IronPython:

http://fepy.blogspot.com/2008/01/using-at-spi-from-ironpython-1.html (« This adventure started when Jim Hugunin mentioned GUI test automation and assistive technology (such as screen readers) share some common needs. While UI Automation is named after the former, AT-SPI is named after the later. AT-SPI, which stands for « Assistive Technology Service Provider Interface » — this is the first of lengthy acronyms that will appear in this post — is an accessibility standard for Unix/X world. Initially developed by the GNOME project, now it is also supported by Java, Mozilla, OpenOffice.org, and Qt 4 …etc. »)

http://fepy.blogspot.com/2008/01/using-at-spi-from-ironpython-2.html (« …Before continuing, let me mention that all the relevant code is in the FePy repository: https://fepy.svn.sourceforge.net/svnroot/fepy/trunk/atspi/« )

– nouvelle liste pour la réorganisation des bibliothèques de Python 3.0 : http://lists.peadrop.com/listinfo.cgi/python-stdlib-reorg-peadrop.com

http://pypi.python.org/pypi/virtualenv/ (« virtualenv is a tool to create isolated Python environments. The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.4/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded. Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application. Also, what if you can’t install packages into the global site-packages directory? For instance, on a shared host. In all these cases, virtualenv can help you. It creates an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t use the globally installed libraries either). »)

http://sagemath.org.(« Une intervention sur la liste python 3000 à propos de sagemath: « All Python-based, developed originally by a number theorist (http://wstein.org), and with a rapidly growing team of developers
(including John Cremona, who’s contributed a lot of his code to Sage).
The Python-dev team should be proud of the impact Python is having in
scientific computing: python is without a doubt the leading tool for open
source, high-level scientific codes (i.e. not Fortran/C), and growing…
http://wiki.sagemath.org/days8 Just contact me off list at Fernando.Perez@colorado.edu if you think you’d like to attend.
) »

– quelques liens sur Python et LDAP:

http://stacktrace.it/articoli/2008/01/metaclassi-python-3000/ (une discussion sur python 3000 à propos des métaclasses:

> On Jan 13, 2008 9:37 AM, Charles Merriam <charles.merriam@gmail.com> wrote:
>> Well, I’m explicitly dropping this. So far no one has pointed out any use cases that are not equivalent to intercepting an array of the namespace in the __init__() of a subclass of type, then calling
type’s __init__() on the modified namespace.

There are many use cases. For instance in
http://stacktrace.it/articoli/2008/01/metaclassi-python-3000/
I discuss operator overloading on records. The paper is in Italian, but you can just look at the code and at the examples.

Michele Simionato

You’ve misunderstood Michele’s example code. __add__ in the
metaclass lets you add two *record classes* together, not two records.

Your proposal didn’t support this behavior, nor *any other use case* for actually having a metaclass (as opposed to class decoration).

You might find this metaclass tutorial enlightening, especially the section I’ve linked to:

http://www.ibm.com/developerworks/linux/library/l-pymeta2/#h4

In the paper I have a metaclass definining the methods __new__, __eq__, __call__, __add__ and __repr__ in the class body. In Python, the ability to define methods in the class body is purely syntactic sugar. One could just define the methods externally and attach them to the class dictionary later on.
Or one could just have a single __new__ method taking a dictionary as argument
(even for ordinary classes) and setting all the methods, possibly with
a memoization mechanism, since you don't want to reset all the methods at each instantiation.
However, everybody basically agrees that it is nicer to define the
methods in the class body for ordinary classes, so why it should be different in metaclasses?
Special cases are not special enough.

http://www.python.org/dev/peps/pep-3115/ (« …This PEP proposes changing the syntax for declaring metaclasses, and alters the semantics for how classes with metaclasses are constructed…The primary reason for changing the way metaclasses work, is that there are a number of interesting use cases that require the metaclass to get involved earlier in the class construction process than is currently possible. Currently, the metaclass mechanism is essentially a post-processing step. With the advent of class decorators, much of these post-processing chores can be taken over by the decorator mechanism…

     In the new model, the syntax for specifying a metaclass is via a
     keyword argument in the list of base classes:

       class Foo(base1, base2, metaclass=mymeta):
         ...

     Additional keywords will also be allowed here, and will be passed to
     the metaclass, as in the following example:

       class Foo(base1, base2, metaclass=mymeta, private=True):
         ...

« )

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s

 
%d blogueurs aiment cette page :