On 22 June 2015, the Boston Python User Group had a night of seven lightning talks. These are notes I took for personal use; they're not a perfect re-telling of what each talk was about (or even what each talk was called).
John and a friend distant from him in his social graph each ended up being stood up by friends at the same bar. They decided to sit down and solve the world's problems. They ended up enjoying their time, so John wanted to find a way to automate this sort of process.
The idea is something like this:
John found that:
I was semi-lost on this one. The project was related to genetics somehow, and I know nothing about computational genetics.
He built a cloud management platform that lets biologists and researchers (read: not developers) easily spin up nodes, install necessary software, run their code, and kill their cluster when they're done with it.
.format()
ing without tearsThe standard str.format()
method in Python will throw a KeyError
if a name
isn't found in the dictionary. Rick made his own function to avoid that problem.
Here's how it works:
('foo', '{foo}'), ('bar', '{bar}'),
('baz', '{baz}')
)dict()
)At first, it seemed to me like another way to implement this behavior would be
to provide .format()
with a dictionary that, instead of throwing a KeyError
when encountering an unknown key, would return a modified version of the key
which was asked for. I tried to do that, and it turns out that doesn't work
class FancyDict(object):
def __init__(self, dictionary):
self.__dictionary = dictionary
def __getitem__(self, key):
try:
return self.__dictionary[key]
except KeyError:
return '{' + key + '}'
def keys(self):
return self.__dictionary.keys()
if __name__ == '__main__':
params = { 'foo': 'this is foo', 'bar': 'this is bar', 'baz': 'this is baz' }
print '{foo} {bar} {baz}'.format(**params)
# this is foo this is bar this is baz
params = { 'foo': 'this is foo', 'bar': 'this is bar' }
print '{foo} {bar} {baz}'.format(**params)
# KeyError: 'baz'
params = FancyDict({ 'foo': 'this is foo', 'bar': 'this is bar' })
print '{foo} {bar} {baz}'.format(**params)
# KeyError: 'baz'
str.format()
gets the keys of the dictionary and will throw a KeyError
if
any of the strings in curly braces are absent.
I was completely out of my league on the domain of this one, which was something related to biology.
It looked like a neat web-based visualization project.
I wasn't super familiar with the domain (statistics).
The big takeaway was that how we measure value affects how much value we observe. I'm not sure what that means.