On or about 2009 Oct 19, at 3:57 PM, Sander Sweers indited:
I missed that the try: did not return anything. I was thinking more of
something like this.
def upperfy(item):
try:
item.upper()
return item
except AttributeError:
return item
Thanks for correcting me!
Depe
On or about 2009 Sep 10, at 11:36 AM, Serdar Tumgoren indited:
I think a list comprehension might be the most compact way to
accomplish what you're after:
objcts = [a, b, c]
titles = [obj.title for obj in objcts]
That probably is the best form.
For the sake of showing other options:
from o
On or about 2009 Sep 8, at 1:51 PM, Alan Gauld indited:
"kevin parks" wrote
What would this look like if i want to use a straight up built-in
dictionary type and not the collections.defaultdict.
Not too different:
import collections
def foo():
lookup = collections.defaultdict(list)
# Dou
Check out:
http://us.pycon.org/2009/conference/schedule/event/73/
which has the video of the talk as well.
That was one of the many talks I didn't see in person, and is on my
queue to watch. Hmmm, just got bumped a lot higher on the queue
since I've also recently been bitten by the Arduino bug
Check out:
http://us.pycon.org/2009/conference/schedule/event/73/
which has the video of the talk as well.
That was one of the many talks I didn't see in person, and is on my
queue to watch. Hmmm, just got bumped a lot higher on the queue since
I've also recently been bitten by the Arduino bug
On 2009 Sep 5, at 12:22 PM, Mark Tolonen wrote:
As a list comp:
L=range(30,41)
[{38:34,40:39}.get(n,n) for n in L]
[30, 31, 32, 33, 34, 35, 36, 37, 34, 39, 39]
True, that is terse, but IMHO has maintainability issues. The mapping
data structure and the method of transformation (.get()) ar
On or about 2009 Sep 5, at 10:45 AM, Martin A. Brown indited:
Have you discovered the map() builtin yet?
I would imagine that others on this list will have some even more
elegant and efficient solutions for you, but here's a possibility:
def filt_seq( thing ):
if thing == 38:
thing = t
Hi!
Hi!
There's three first rows that belong to the same subject. And then
next three rows belong to another subject and so on, to the end of
the file.
Thanks for clarifying, you're input comes in lines, and the lines are
grouped in threes.
What I need to do, is put the three rows tha
On 2009 Aug 18, at 7:57 PM, Jramak wrote:
Hello
We have developed three custom applications in Python. Each one of
these applications needs a different PYTHONPATH, in addition to
different environment variables to work. Instead of manually setting
the environment variables for each application, w