Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home Topics pydev
Navigation
 

pydev

May 10, 2010

Unchained melody

by Alessandro Pisa — last modified May 10, 2010 06:10 PM
Filed Under:

Collection concatenation can be done in many ways. A fairly underused way is to use the builtin chain method

Let's suppose you have to concatenate several collections objects, e.g.:

>>> a=range(3)
>>> b=set('ale')
>>> c=(a,b)

One easy way to do that is to create an empty list and use the extend method

>>> cat=[]
>>> cat.extend(a)
>>> cat.extend(b)
>>> cat.extend(c)
>>> cat
[0, 1, 2, 'a', 'e', 'l', [0, 1, 2], set(['a', 'e', 'l'])]

But another elegant way do achieve the same result is to use the chain function from itertools

>>> from itertools import chain
>>> chain(a,b,c)

>>> cat=list(chain(a,b,c))
>>> cat
[0, 1, 2, 'a', 'e', 'l', [0, 1, 2], set(['a', 'e', 'l'])]

This is especially useful when you have big amount of data because the result of the chain function is an iterator

How to make your team mates think you are someway useful

by Alessandro Pisa — last modified May 10, 2010 06:05 PM
Filed Under:

Disclaimer: vi integralist should skip this post :)

During a technical meeting here in RedTurtle, me and my colleagues were exposing fancy stuffs about software development and I was amazed that the attention of my team mates was triggered by me using a self made Pydev template to insert the encoding on top of Python files.

So here, I am reporting this to the whole planet, hoping someone else will appreciate this simple time saving tip :)

Adding a new template in Pydev is really easy, just go to Window -> Preferences... A configuration window should appear (see image below).

Screenshot
 of Pydev 
configuration window

Navigate the tree panel on the left: Pydev -> Editor -> Templates and add click on the New button.

Another window will appear, where you can insert a name for your template (in my case utf8), a description (Insert encoding in the file) and the text to be inserted when this template is used (# -*- coding: utf-8 -*-).

With this template configured, insert che utf-8 encoding in to a file is just as easy as typing ut[CTRL]+[SPACE].

 

Sep 06, 2009

Pydev 1.5.0: into the wild

by Alessandro Pisa — last modified Sep 06, 2009 05:40 PM
Filed Under:

Il papà di Pydev annuncia il rilascio della versione 1.5.0 di questo eccezionale plugin per eclipse. La novità principale è che per la prima volta sarà completamente open source!

Da anni Pydev è uno degli strumenti favoriti da una moltitudine di sviluppatori Python per merito della sua completezza

Fino a poco tempo fa al plugin open source Pydev si affiancava Pydev Extensions, liberamente scaricabile ma a codice chiuso. Dall'ultima versione, la 1.5.0, Pydev e Pydev  Extensions sono stati unificati in un unico progetto open source! La notizia è stata data in questo annuncio da Fabio Zadrozny, lo sviluppatore che ha ideato questo gioiello.

Il link per l'installazione tramite eclipse è: http://pydev.org/updates

N.B.: occorre rimuovere eventuali versioni precedenti di Pydev prima di procedere all'aggiornamento.

Non possiamo che apprezzare Aptana, la società che finanzia lo sviluppo di Pydev, per questa scelta! Se nell'immediato si limita a togliere a molti sviluppatori il fastidio di chiudere una finestra promozionale. che compare periodicamente mentre si utilizza eclipse, nel lungo periodo permetterà a questo plugin di crescere con maggiore rapidità e di conquistare sempre più utenti.

Riferimenti:

  1. Il link della notizia originale
  2. La home page di Pydev
  3. La home page di Aptana
  4. Link per aggiornare eclipse: http://pydev.org/updates