in an iterable into a string using the prefix operator as a separator:
'--'.join( ['My', 'dog', 'has', 'fleas'] )
returns the string 'My--Dog--has--fleas'
def myprint(*args,sep=' ',end='\n'):
s = sep.join(str(x) for x in args)+end # create string to print
print(s,end='') # print the string
WARNING: Once students learn about comprehensions, sometimes they go a bit
overboard as they learn about/use this feature. Here are some warning signs:
When writing a comprehension, you should (1) use the result produced in a later
part of the computation and (2) typically not mutate anything in the
comprehension. If the purpose of your computation is to mutate something,
don't use a comprehension. Over time you will develop good instincts for when
to use comprehensions.
Tuple Comprehensions are special:
The result of a tuple comprehension is special. You might expect it to produce
a tuple, but what it does is produce a special "generator" object that we can
iterate over. We will discuss generators in detail later in the quarter, so for
now we will examine just some simple examples. Given the code
x = (i for i in 'abc') # tuple comprehension
print(x)
You might expect this to print as ('a', 'b', 'c') but it prints as
(generator object (genexpr) at 0x02AAD710>
The result of a tuple comprehension is not a tuple: it is actually a generator.
The only thing that you need to know now about a generator is just that you can
iterate over it, but ONLY ONCE. So, given the code
x = (i for i in 'abc')
for i in x:
print(i)
for i in x:
print(i)
it prints
a
b
c
Yes, it prints a, b, c and just prints it once: after the first loop finishes,
the generator is exhausted so the second loop prints no more values. We will
spend a whole lecture studying the details of generators later in the quarter.
Specifically, if x is defined as above, we cannot call len(x) or x[1]: it is
not a tuple, it is a generator. All we can do it iterate over x.
Recall our discussion of changing any iterable into a list, tuple, or set by
iterating over it; we can iterate over a tuple comprehension. So if we wrote
t = tuple(x) or t = tuple( (i for i in 'abc') ), then print(t) would print
('a', 'b', 'c'). In fact, we could even write t = tuple(i for i in 'abc')
because (1) by default, comprehensions are tuple comprehensions; (2) in a
function call with exactly one argument, we can omit the () specifying a tuple
comprehension (but with multiple arguments we must supply the parentheses).
Of course, we could also write things like :
l = list(i for i in 'abc')
s = set (i for i in 'abc')
but these are equivalent to writing the standard comprehensions more simply
(and efficiently) as:
l = [i for i in 'abc']
s = {i for i in 'abc'}
The split/join methods
Both split and join are methods in the str class: if s is some string, we call
them by writing s.split(...) or s.join(....)
The split method also takes one str argument as .... and the result it returns
is a list of of str. For example 'ab;c;ef;;jk'.split(';') returns the list of
str
['ab', 'c', 'ef', '', 'jk']
It uses the argument str ';' to split up the string (the one prefixing the
.split call), into slices that come before or after every ';'.
Note that there is an empty string between 'ef' and 'j' because two adjacent
semi-colons appear between them in the string. If we wanted to filter out such
empty strings, we can easily do so by embedding the call to split inside a
comprehension: writing [s for s in 'ab;c;ef;;jk'.split(';') if s != '']
produces the list ['ab', 'c', 'ef', 'jk'].
Because the prefix and regular arguments are both strings, students sometime
reverse these two operands: what does ';'.split('ab;c;ef;;jk') produce and why?
The split method is very useful to call after reading lines of text from a file,
to parse (split) these lines into their important constituent information.
You will use split in all 5 parts of Programming Assignment #1.
-----
The join method also takes one iterable argument (it must produce str values)
as ....; the result it returns is a str.
For example
';'.join(['ab', 'c', 'ef', '', 'jk']) returns the str
'ab;c;ef;;jk'
It merges all the strings produced by iterating over its argument into one big
string, with all the strings produced by iterating over its argument
concatenated together and separated from each other by the ';' string.
So, split and join are opposites. Unfortunately, the splitting/joining string
';' appears as the argument inside the () in split, but it appears as the prefix
argument before the call in join. This inconsistency can be confusing.
The all/any functions (and their use with tuple comprehensions)
The "all" function takes one iterable argument (and returns a bool value): it
returns True if ALL the bool values produced by the iterable are True; it can
stop examining values and return a False result when the first False is produced
(ultimately, if no False is produced it returns True).
The "any" function takes one iterable argument (and returns a bool value): it
returns True if ANY the bool values produced by the iterable are True; it can
stop examining values and return a True result when the first True is produced
(ultimately, if no True is produced it returns False).
These functions can be used nicely with tuple comprehensions. For example, if
we have a list l of numbers, and we want to know whether all these numbers are
prime, we can call
all( predicate.is_prime(x) for x in l )
which is the same as calling
all( (predicate.is_prime(x) for x in l) )
and similar (but more time/space-efficient) than calling
all( [predicate.is_prime(x) for x in l] )
The list comprehension computes the entire list of boolean values and then
"all" iterates over this list. When "all" iterates over a tuple comprehension,
the tuple comprehension computes values one at a time and "all" checks each: if
one is False, the tuple comprehension returns False immediately and does not
have to compute any further values in the tuple comprehension.
-----Efficiency Interlude
The tupel comprehension version can be much more efficient, if a False value is
followed by a huge number of other values.
For example, calling
all( predicate.is_prime(x) for x in range(2,1000000) )
immediately returns False because it checks whetehr 2 is prime (True), 3 is
prime (True), 4 isn't prime (False: so all finishes executing, returning False).
But calling
all( [predicate.is_prime(x) for x in range(2,1000000)] )
takes a very long time to return False. It first determines whether all values
from 2 to 1,000,000 are prime (putting all these boolean values in the list
comprehension), and then looks at the first (True), the second (True), the
third (False: so all finishes executing, returning False).
This illustrates the very important difference between tuple comprehension and
other kinds of comprehensions.
-----End: Efficiency Interlude
Likewise for the "any" function, which produces True the first time it examines
a True value.
Here is how we can write these functions, which search for a False or a True
respectively:
def all(iterable):
for v in iterable:
if v == False
return False # something was False; return False immediately
return True # nothing was False; return True after loop
def any(iterable):
for v in iterable:
if v == True
return True # something was True; return True immediately
return False # nothing was True; return False after loop
Read these functions. What does each produce if the iterable produces no values?
Why is that reasonable?
The sum/max/min functions (and their use with tuple comprehensions)
The simple versions of the sum function takes one iterable argument. The sum
function requires that the iterable produce numeric values that can be added.
It returns the sum of all the values produced by the iterable; if the iterable
argument produces no values, sum returns 0. Actually, we can supply a second
argument to the sum function; in this case, that value will be returned in the
special case when the iterable produces no values; if the iterable does produce
any values, the sum will be the actual sum plus this argument. We can think of
sum as defined by
def sum(values, init_sum=0):
result = init_sum
for v in values:
result += v
return result
The simple versions of the max and min functions also each take one iterable
argument.
The min/max functions require that the iterable produce values that can be
compared with each other; so calling min([2,1,3]) returns 1; and calling
min(['b','a','c']) returns 'a'; but calling min([2,'a',3]) raises a TypeError
exception because Python cannot compare an integer to a string. These functions
return the minimum/maximum value produced by their iterable argument; if the
iterable produces no values (e.g., min([]), min and max each raise a ValueError
exception, because there is no minimum/maximum value that it can compute/return.
There are two more interesting properties to learn about the min and max
functions.
First, we can also call min/max specifying any number of arguments or if one
argument, it must be iterable: so calling min([1,2,3,4]) -using a tuple which it
iterable- produces the same result as calling min(1,2,3,4) -using 4 arguments.
We can also specify a named argument in min/max: a key function just like the
key function used in sort/sorted. The min/max functions return the
smallest/largest value in its argument(s), but if the key function is supplied,
it compares two values by calling the key function on each, not by directly
comparing these two value.
For example, min('abcd','xyz') returns 'abcd', because 'abcd' < 'xyz'. But if
we instead wrote min('abcd','xyz',key = (lambda x : len(x)) ) it would return
'xyz' because len('xyz') < len('abcd'): that is, it compares the key function
applied to all values in the iterable to determine which value to return.
Note that min('abcd','wxyz',key = (lambda x : len(x)) ) will return 'abcd'
because it is the first value that has the smallest result when the key
function is called: the key function returns 4 for both values. We can think of
the min function operating on an iterable to be written as follows (although we
will learn Python features later on that simplifies the actual definition of
this function)
def min(*args,key = (lambda x : x) ): # default key is the identity function
if len(args) == 0:
raise TypeError('min: expected >=1 arguments, got 0')
if len(args) == 1: # Assume that if min has just one argument
args = args[0] # it's iterable, so take the max over its values
answer = None
for v in args:
key_of_v = key(v)
if answer == None or key_of_v < key_of_answer:
answer = v
key_of_answer = key_of_v
return answer
Calling min( ('abc','def','gh','ij'),key = (lambda x : len(x)) ) returns 'gh'.
Note that the default value for the key function is a lambda that returns the
value it is passed: this is called the identity function/lambda.
The zip and enumerate functions
Zip:
There is a very interesting function called zip that takes an arbitrary number
of iterable arguments and zips/interleaves them together (like a zipper does
for the teeth on each side). Let's start by looking at just the two argument
version of zip.
What zip actually produces is a generator -the ability to get the results of
zipping- not the result itself. See the discussion above about how tuple
comprehensions produce generators.
So to "get the result itself" we should use a for loop or constructor (as shown
in most of the examples below) to iterate over the generator result of calling
zip. The following code
z = zip( 'abc', (1, 2, 3) ) # String and tuple are iterator arguments
print('z:', z, 'list of z:', list(z))
prints
z: (zip object at 0x02A4D990) list of z: [('a', 1), ('b', 2), ('c', 3)]
Here, z refers to a zip generator object; the result of using z in the list
constructor is [('a', 1), ('b', 2), ('c', 3)] which zips/interleaves the values
from the first iterable and the values from the second:
[(first from first,first from second),(second from first,second from second),
(third from first,third from second)]
What happens when the iterables are of different lengths? Try it.
z = zip( 'abc', (1, 2) ) # String and tuple for iterables
print(list(z)) # prints [('a', 1), ('b', 2)]
So when one iterable runs out of values to produce, the process stops. Here is
a more complex example with three iterable parameters of all different sizes.
Can you predict the result it prints: do so, and only then run the code.
z = zip( 'abcde', (1, 2, 3), ['1st', '2nd', '3rd', '4th'] )
print(list(z))
which prints
[('a', 1, '1st'), ('b', 2, '2nd'), ('c', 3, '3rd')]
Of course, this generalizes for any number of arguments, interleaving them all
(from first to last) until any iterable runs out of values. So the number of
values in the result is the minimum of the number of values of the argument
iterables.
Note one very useful way to use zip: suppose we want to iterate over values in
two iterables simultaneously, i1 and i2, operating on the first pair of values
in each, the second pair of values in each, etc. We can use zip to do this by
writing:
for v1,v2 in zip(i1,i2):
process v1 and v2: the next pair of values in each
So
for v1,v2 in zip ( ('a','b','c'), (1,2,3) ):
print(v1,v2)
prints
a 1
b 2
c 3
Using zip, we can write a small function that computes the equivalent of the
< (less than) operator for strings in Python (see the discussion above about
the meaning of < for strings).
def less_than(s1 : str, s2 : str)-> bool:
for c1,c2 in zip(s1,s2): # examine 1st, 2nd, ... characters of each string
if c1 != c2: # if current characters are different
return c1 < c2 # compute result by comparing characters
# if all character from the shorter are the same (as in 'a' and 'ab')
# return a result based on the length of the strings
return len(s1)< len(s2)
This precisely caputures in Python code our prose discussion of the meaning of
comparing strings.
Enumerate:
Finally, this is a convenient time to toss in another important function:
enumerate. It also also produces a generator as a result, but has just one
iterable argument, and an optional 2nd argument that is a starting number. It
produces tuples whose first values are numbers (starting at the value of the
second parameter; omit a 2nd parameter and unsurprisingly, the starting number
is 0) and whose second values are the values in the iterable. So, if we write
e = enumerate(['a','b','c','d'], 5)
print(list(e))
it prints
[(5, 'a'), (6, 'b'), (7, 'c'), (8, 'd')]
Given l = ['a','b','c','d','e'] we could write the following code
for i in range(len(l)):
print(i+1,l[i])
(which prints 1 a, 2 b, 3 c, 4 d, and 5 e on separate lines) more simply by
using enumerate (notice the use of parallel/tuple assignment for i,x):
for i,x in enumerate(l,1):
print(i,x)
Another nice example illustrating enumerate is reading a file a line at a time,
and processing the line number and the line contents.
Instead of writing
line_number = 1
for line in open("file-name"):
.... process line_number and line
line_number += 1
we can write just
for line_number, line in enumerate(open("file-name"),1):
.... process line_number and line
You might ask now, why do these things (tuple comprehension, zip, enumerate)
produce generators and not just tuples or lists? That is an excellent question.
It goes right along with the excellent question why does sorted(...) produce a
list and not a generator? We will discuss these issues later in the quarter.
The generator question mostly has to do with space efficiency when iterating
over very many values. The sorted question has to do with why there is no way
to do this operation in a space efficient way.
**kargs for dictionary of not-matched named arguments in function calls
Recall the use of *args in a function parameter list. It combines into one
tuple a sequence of positional arugments. We can also write the symbol **kargs
(we can write ** and any word, but kargs or kwargs are the standard ones). If
we use it to specify this kind of parameter, it must occur as the last
parameter. kargs stands for keyword arguments. Basically, if Python has any
keywords arguments that do not match keyword parameters (see the large
discussion of argument/paramteter binding above, which includes *args but
doesn't include **kargs) they are all put in a dictionary that is stored in the
last parameter named kargs.
So, imagine we define the following function
def f(a,b,**kargs):
print(a,b,kargs)
and call it by
f(c=3,a=1,b=2,d=4)
it prints: 1 2 {'c': 3, 'd': 4}
Without **kargs, using the rules specified before, Python would report a
TypeError exception (by rule M5(d)), because there are no parameter named
c or d.
By the new rules, Python finds two named arguments (c=3 and d=4) whose names
did not appear as parameter names in the function header of f (which specifies
only a and b, and of course the special **kargs), so while Python directly
binds a to 1 and b to 2 (the parameter names specified in the function header,
matched to similarly named arguments) it creates a dictionary with all the
other named arguments: {'c': 3, 'd': 4} and binds kargs to that dict.
The same result would be printed for the call
f(1,2,d=4,c=3)
We will use **kargs to understand a special use of of dict constructors (below).
We will also use **kargs (and learn something new in the process) when
discussing how to (1) call methods in decorators and (2) call overridden
methods using inheritance much later in the quarter.
Note that to write a perfectly general function that is called with any kinds
of arguments we can write
def g(*args,**kargs):
print(args,kargs)
Now, any legal call of g (one with any legal combination of positional and
named arguments) will populate the *args and **kargs structures appropriately.
Calling
g(1,2,c=3,d=4) prints (1, 2) {'c': 3, 'd': 4}
g(a=1,b=2,c=3,d=4) prints () {'c': 3, 'b': 2, 'a': 1, 'd': 4}
Generally, when a parameter name is prefixed by * and ** in a function header,
we omit the prefix when we use the parameter name inside the function. But
there are times where use use the * and ** prefixes.
def h(a,b,c,d):
print(a,b,c,d)
def i(*args,**kargs):
h(*args,**kargs)
The arguments *args and **kargs in the call of h expand the args tuple to
be positional arguments and the **kargs dictionary to be named arguments
Calling
i(1,2,c=3,d=4) prints 1 2 3 4: it calls h(1,2,c=3,d=4)
i(a=1,b=2,c=3,d=4) prints 1 2 3 4: it calls h(c=3,b=2,a=1,d=4)
Summarizing:
1) Writing * and ** when specifying parameters makes those parameters names
bind to a tuple/dict respectively.
2) Using the parameter names by themselves in the function is equivalent to
using the tuple/dict respectively.
3) Using * and ** followed by the parameter name as ARGUMENTS IN FUNCTION
CALLS expands all the values in the tuple/dict respectively to represent
all the arguments.
Experiment with *args/**kargs as parameters of functions and args/kargs and
*args/**kargs as arguments to other function calls.
-----Interlude
We have seen that to call sorted with a lambda we must write something like
sorted(iterable, key = (lambda ...))
One might ask, is the key paraemeter to sorted the second one? Could we write
sorted(iterable, (labmda ...))
to accomplish the same call? The answer is "no" we cannot. If we want to use
a lambda, we must write a named argument as key = (lambda ...). Similarly, we
must write reverse = ....
How do you think the header of the sorted function is written?
Lists, Tuples, Sets, Dictionaries (frozenset and defaultdict)
You need to have pretty good grasp of these important data types, meaning how to
construct them and the common methods/operations we can call on them. Really
you should get familiar with reading the online documentation for all these
data types (see the Python Library Reference link on the homepage for the
course).
4. 6: Sequence Types includes Lists (mutable) and Tuples (immutable)
4. 9: Set Types includes set (mutable) and frozenset (immutable)
4.10: Mapping Types includes dict and defaultdict (both mutable)
Here is a very short/condensed summary of these operations. Experiment with
them in Eclipse.
-----
4.6: Sequence Types includes Lists (mutable) and Tuples (immutable)
These sequence operations (operators and functions) are defined in 4.6.1
x in s, x not in s, s + t, s * n, s[i], s[i:j], s[i:j:k], len(s), min(s),
max(s), s.index(x[, i[, j]]), s.count(x)
Mutable sequence allow the following operations, defined in 4.6.3
s[i] = x , s[i:j] = t, del s[i], s[i:j:k] = t, del s[i:j:k], s.append(x)
s.clear(), s.copy(), s.extend(t), s.insert(i, x), s.pop(), s.pop(i),
s.remove(x), s.reverse()
It also discusses list/tuple constructors and sort for list.
note that the append method is especially important for building up sequences
like lists. Also to return and remove a value from a sequence, we call
x = s.pop(i)
is equivalent to
x = s[i]
del s[i]
and calling s.pop() uses the value len(s)-1 (the last index in the sequence)
-----
4. 9: Set Types includes set (mutable) and frozenset (immutable)
These set (operators and functions) are defined in <IP_ADDRESS>
len(s), x in s, x not in s, isdisjoint(other), issubset(other), set <= other,
set < other, issuperset(other), set >= other, set > other, union(other, ...),
intersection(other, ...), difference(other, ...), symmetric_difference(other),
copy; also the operators | (for union), & (for intersection), - (for
difference), and ^ (for symmetic difference)
Sets, which are mutable, allow the following operations
update(other, ...), intersection_update(other, ...),
difference_update(other, ...), symmetric_difference_update(other), add(elem),
remove(elem), discard(elem), pop(), clear(); also the operators |= (union
update), &= (intersection update), -= (difference update), ^= (symmetric
difference update)
-----
4.10: Mapping Types includes dict and defaultdict (both mutable)
These dict (operators and functions) are defined in 4.10
d[key] = value , del d[key], key in d, key not in d, iter(d), clear(), copy(),
fromkeys(seq[, value]), get(key[, default]), items(), keys(),
pop(key[, default]), popitem(), setdefault(key[, default]), update([other]),
values()
Important Notes on dicts:
d[k] returns the value associated with a key (raises exception if k not in d)
d.get(k,default) returns d[k] if k in d; returns default if k not in d
it is equivalent to the conditional expression (d[k] if k in d else default)
d.setdefault(k,default) returns d[k] if k in d; if k not in d it
(a) sets d[k] = default
(b) returns d[k]
writing d.setdefault(k,default) is equivalent to (but more efficient than)
writing
if k in d:
return d[k]
else
d[k] = default
return d[k]
There is a type called defaultdict (see 8.3.4) whose constructor generally
takes an argument that is a reference to any object that CAN BE CALLED WITH NO
ARGUMENTS. Very frequently we use a NAME OF A CLASS that when called will
CONSTRUCT A NEW VALUE: if the argument is int, it will call int() producing the
value 0; if the argument is list, it will call list() producing an empty list;
if the argument is set, it will call set() producing an empty set; etc.
Whenever a key is accessed for the first time (i.e., that key is accessed but
not already associated with a value in the dictionary) in a defaultdictionary,
it will associate that key with the value created by calling the reference to
the object supplied to the constructor.
Here is an example of program first written with a dict, and simplified later
by using a defaultdict.
letters = ['a', 'x', 'b', 'x', 'f', 'a', 'x']
freq_dict = dict() # could use = {}
for l in letters:
if l not in freq_dict: # must check l in freq_dict before freq_dict[l]
freq_dict[l] = 1 # if not there, put with frequency of 1
else:
freq_dict[l] += 1 # otherwise there, increment frequency
print(freq_dict)
This would print the following dict: {'b': 1, 'x': 3, 'f': 1, 'a': 2}
As each letter in the loop is processed, it is associated with 1 (if not already
in the dict) or it is in the dict, and its associated value is incremented by 1.
We could solve this a bit more easily with a defaultdict.
from collections import defaultdict # in same module as namedtuple
letters = ['a', 'x', 'b', 'x', 'f', 'a', 'x']
freq_dict = defaultdict(int) # int not int(); but int() returns 0 when called
for l in letters:
freq_dict[l] += 1 # in dict, exception raised if l not in d, but
print(freq_dict) # defaultdict calls int() putting 0 there first
As each letter in the loop is processed, its associated key is looked up:
if the key is absent, it it placed in the dict assocatiated with int()/0; then
then the associated value (possibly the one just put in the dict) is
incremented by 1.
The dict code below is equivalent to how the defaultdict code above works.
letters = ['a', 'x', 'b', 'x', 'f', 'a', 'x']
freq_dict = dict() # could use = {}
for l in letters:
if l not in freq_dict: # must check l in freq_dict before freq_dict[l]
freq_dict[l] = int() # int() constructor returns 0; could write 0 here
freq_dict[l] += 1 # l is guaranteed in freq_dict, either because
print(freq_dict) # it was there originally, or just put there
Another way to do the same thing (but also a bit longer and less efficient)
uses the setdefault method (listed above)
letters = ['a', 'x', 'b', 'x', 'f', 'a', 'x']
freq_dict = dict() # note dict only
for l in letters:
freq_dict[l] = freq_dict.setdefault(l,0) + 1
print(freq_dict)
Here we evaluate the right side of the = first; if l is already in the dict,
its associated value is returned; if not, l is put in the map with an associated
value of 0, then this assocated value is returned (and then incremented, and
stored back into freq_dict[l] replacing the 0 just put there).
You should achieve a good understanding of why each of these four scripts work
and why they all produce equivalent results.
Often we use defaultdicts with list instead of int: just as int() produces the
object 0 associated with a new key, list() creates an empty list associated
with a new key (and later we add things to that list); likewise we can use
defaultdicts with set to get an empty set with a new key.
So, if we wrote x = defaultdict(list) and then immediately wrote
x['bob'].append(1) then x['bob'] is associated with the list [1] (the empty
list, with 1 appended to it). If we then wrote x['bob'].append(2), then
x['bob'] is associated with the list [1, 2]. So, we can always append to the
value associated with a key, because it will use an empty list to start the
process if there is nothing associated with a key.
How could we specify a defaultdict that initializes keys with the value 5?
Translation: in what simple way can we pass to defaultdict an arguement that is
a function of no parameters, which returns the value 5. The solution can lead
to all sorts of interesting variants, say for a defaultdict whose unknown keys
are automatically associated with a dict (or another defaultdict).
Note that the ==/!= operators for dictionaries work correct between dicts and
defaultdicts. They are considered equal so long as they have the equal keys, and
each key is associated with an equal value.
Just as with comprehensions, what is important is that we know how things like
defaultdicts and dicts (with the setdefault method) work, so that we can
correctly write code in any of these ways. We can decide afterwords which way
we want the code to appear. As we program more, our preferences might change.
I have found defaultdicts are mostly what I to use to simplify my code, but
every so often I must use a regular dict.
Later in the quarter we will use inheritance to show how to write the
defaultdict class simply, by extending the dict class.
Printing Dictionaries in Order: An example of using comprehensions and sorted
In this section we will combine our knowledge about the sorted function,
comprehensions, and iteratring over dictionaries to examine how we can print
(or generally process) dictionaries in arbitrary orders.
Generally, all of our code will be of the form
for index(es) in sorted( iterable, key = (lambda x : ....) ):
print( index(es) )
In these examples, we will use the simple dictionary
d = {'x': 3, 'b': 1, 'a': 2, 'f': 1}
In each example, we will discuss the relationships among index(es), iterable,
and the (lambda x : ....) in the function bound to the key parameter.
1) In the first example, we will print the dictionary keys in increasing
alphabetical order, and their associated values, by iterating over d.items().
for k,v in sorted( d.items(), key = (lambda item : item[0]) ):
print(k,'->',v)
which prints as
a -> 2
b -> 1
f -> 1
x -> 3
Here, iterable is d.items(), which produces 2-tuples storing each key and its
associated value, for every item in the dictionary; the item in lambda item is
also a key/value 2-tuple (specifying here to sort by item[0], the key part in
the 2-tuple); finally, the list returned by sorted also contains key/value
2-tuples, which are unpacked into k and v and printed.
We can solve this same problem by iterating over just the keys in d as well.
for k in sorted( d.keys(), key = (lambda k : k) ):
print(k,'->',d[k])
Here, iterable is d.keys() which produces strings storing each key in the
dictionary; the k in lambda k is also a key/str value (specifying here to
sort by k, the key itself: I could have omitted this identity lambda); finally,
the list returned by sorted also contains key/str value, which are stored into
k and printed along with d[k].
This code is equivalent to the following, since d.keys() is the same as just d,
and lambda x : x is the default for the key parameter.
for k in sorted( d ):
print(k,'->',d[k])
2) In the second example, we will print the dictionary keys and their associated
values, in increasing order of the values, by iterating over d.items().
for k,v in sorted( d.items(), key = (lambda item : item[1]) ):
print(k,'->',v)
which prints as
b -> 1
f -> 1
a -> 2
x -> 3
Here, iterable is d.items(), which produces 2-tuples storing each key and its
associated value, for every item in the dictionary; the item in lambda item is
also a key/value 2-tuple (specifying here to sort by item[1], the value part in
the 2-tuple); also, the list returned by sorted also contains key/value
2-tuples, which are unpacked into k and v and printed. Finally, by this
lambda either b or f might be printed first, because they have the same value
associated with them.
We can solve this same problem by iterating over just the keys in d as well.
for k in sorted( d.keys(), key = (lambda k : d[k]) ):
print(k,'->',d[k])
Here, iterable is d.keys() which produces strings storing each key in the
dictionary; the k in lambda k is also a key/str value (specifying here to sort
by d[k], the value associated with the key); finally, the list returned by
sorted also contains key/str values, which are stored into k and printed along
with d[k].
This code is equivalent to the following, since d.keys() is the same a d; the
lambda is still needed here because it is not the identity lambda.
for k in sorted( d, key = (lambda k : d[k]) ):
print(k,'->',d[k])
In both cases, Python uses the LEGB rule: d is not a parameter to the lambda,
but it might be defined in the Enclosing or Global scope, so it can be used
in the lambda.
3) In the third example, we will compute a list that contains all the keys in a
dictionary, sorted by their associated values (in decreasing order of the
values), by iterating over d.keys() (really just d, to simplify the code)
We compute
ks = sorted(d, key = (lambda k : d[k]), reverse = True)
ks stores ['x', 'a', 'b', 'f'].
We could also compute this list less elegantly using d.items().; I say less
elegantly, because we need a comprehension to "throw away" the value part of
each item returned by sorted.
ks = [k for k,v in sorted(d.items(), key=(lambda item : item[1]), reverse=True)]
4) Finally, in the fourth example, we will compute a list that contains all the
2-tuples in the items of d, but the tuples are reversed (values before keys) and
sorted in increasing alphabetical order by keys.
We compute this list of 2-tuple in the following two ways
vks = [ (v,k) for k,v in sorted( d.items(), key = (lambda item : item[0]) ) ]
vks = sorted( ((v,k) for k,v in d.items()), key = (lambda item : item[1]) )
vks stores [(2, 'a'), (1, 'b'), (1, 'f'), (3, 'x')]
The top computation first creates a sorted version of d by keys, and then uses a
comprehension to create tuples that reverse the keys/values; the bottom
computation first uses a comprehension to create a list of reversed keys/values,
and then uses sorted to sort these reversed 2-tuples by the keys that are now
in the second part of each tuple.
Using _ as a variable Name:
If you write
ks = [k for k,v in list_of-2-tuples...]
Eclipse will likely give you warning about "variable v is not used". Since
there must be variable to store the second tuple index, but that variable does
not get used, we can write it as just _ (a legal Python variable name)
ks = [k for k,_ in list_of-2-tuples...]
In this case, Eclipse does not indicate a warning. Naming a variable _ implies
you aren't going to to anything useful with it. Although, we can write
for _ in [1,2,3]:
print(_)
and it will print 1, 2, and 3 (on their own lines). By using _ Eclipse
doesn't expect this name to be used.
Exceptions: example from prompt_for_int
We do two things with exceptions in Python: we raise them (with the raise
statement) and we handle them (with the try/except statement). Exceptions were
not in early programming languages, but were introduced big time in the Ada
language in the early 1980s, and have been parts of most new languages since
then.
A function raises an exception if it cannot do the job it is being asked to
do. Rather than fail silently, possibly producing a bogus answer that gets used
to compute a bogus result, it is better that the computation announces a problem
occurred and if no way is known to recover from it (see handling exceptions
below) the computation halts with an error message to the user.
For example, if your program has a list l and you write l[5] but l has nothing
stored at index 5 (its length is smaller), Python raises the IndexError
exception. If you haven't planned for this possibility, and told Python how to
handle the exception and continue the calculation, then the program just
terminates and Python prints:
IndexError: list index out of range
Why doesn't it print the index value 5 and the lenth of list l?. I don't know.
That certainly seems like important and useful information, and Python knows
those two values. I try to make my exception messages include any information
useful to the programmer.
There are lots of ways to handle exceptions. Here is a drastically simplified
example from my prompt class (this isn't the real code, but a simplification
for looking at a good use of exception handling). But it does a good job of
introducing the try/except control form which tries to execute a block of code
and handles any exceptions it raises.
If we write a try/except and specify the name of no exception, it will handle
any exception. The name Exception is the name of the most generic exception.
We can write a try/except statement with many excepts, each one specifying a
specific exception to handle, and what to do when that exception is raised. In
fact, int('x') raises the ValueError exception, so I use ValueError in the
except clause below to be specific, and not accidentally handle any other kind
of exception.
def prompt_for_int(prompt_text):
while True:
try:
response = input(prompt_text+': ') # response is used in except
answer = int(response)
return answer
except ValueError:
print(' You bozo, you entered "',response,'"',sep='')
print(' That is not a legal int')
print(prompt_for_int('Enter a positive number'))
So, this is an "infinite" while loop, but there is a return statement at the
bottom of the try-block; if it gets executed, it returns from the function,
thus terminating the loop. The loop body is a try/except; the body of the
try/except
1) prompts the user to enter a string on the console (this cannot fail)
2) calls int(response) on the user's input (which can raise the ValueError
exception, if the user types characters that cannot be interpreted as an
integer)
3) if that exception is not raised, the return statement returns an int object
representing the integer the user typed as a string
But if the exception is raised, it is handled by the except clause, which
prints some information. Now the try/except is finished, but it is in an
infinite loop, so it goes around the loop again, reprompting the user (over and
over until the user enters a legal int).
Actually, the body of try could be simplified (with the same behavior) to just
response = input(prompt_text+': ') # response is used in except
return int(response)
If an exception is raised while the return statement is evaluating the int
function, it still gets handled in except. We CANNOT write it in one line
because the name response is used in the except clause (in the first print).
If this WASN'T the case, we could write just
return int(input(prompt_text+': ')) # if response not used in except
For example, we might just say 'Illegal input' in the except, but in the example
above, it actually display the string (not a legal int) that the user typed.
Finally, in Java we throw and catch exceptions (obvious opposites, instead of
raise and handle) so I might sometimes use the wrong term. That is because I
think more generally about programming than "in a language", and translate what
I'm thinking to the terminology of the language I am using, but sometime I get
it wrong.
Note that exception handling is very powerful, but should be avoided if a
boolean test can easily determine whether a computation will fail. For example.
l = [...]
if (0 <= i < len(l))
print(l[i])
is preferred to
try:
print(l[i])
except IndexError:
pass
Name Spaces (for objects): __dict__
Every object has a special variable named __dict__ that stores all its
namespace bindings in a dictionary. During this quarter we will systematically
study class names that start and end with two underscores. Writing x.a = 1
is similar to writing x.__dict__['a'] = 1; both associate a name with a value
in the object. We will explore the uses of this kind of knowledge in much more
depth later in the quarter.
Here is a brief illustration of the point above. Note that there is a small
Python script that illustrates the point. This is often the case.
class C:
def __init__(self): pass
o = C()
o.a = 1
print(o.a) # prints 1
o.__dict__['a'] = 2
print(o.a) # prints 2
o.__dict__['b'] = 3
print(o.a,o.b) # prints 2 3
Trivial Things:
An empty dict is created by {} and empty set by set() (we can't use {} for an
empty set because Python would think it is a dict). Any non-empty dicts can
be distinguished from a non-empy set because a non-empty dict will always have
the : character inside {} separating keys from values. Suppose you want to
create a set containing the value 1: which works (and why)? {1} or set(1).
A one value tuple must be written like (1,) with that "funny" comma (we can't
write just (1) because that is just the value 1, not a tuple storing just 1).
Questions
1. Describe, in term of binding, what happens if the first statement in a
module is x = 0, in terms of the module object and its namespace.
2. Assume that we have executed the statement x = 1. Describe, in terms of
binding, what is the semantics of the statement x += 1.
3. What is printed in print(f(0)) if we define f as follows?
def f(x):
pass
4. Using the kind of pictures dicussed in the Binding section above, illustrate
the meaning of a module named m that contains the following statements:
x = 1
y = 2
z = y
And a module named script that contains the following statements:
import m
a = m.x
m.y = 10
from m import y
from m import z as b
z = y
del m.z
c = 10
The result will be two large rounded-rectangles (objects for modules m and
script) which contain labeled boxes that refer to other rounded-rectangles
(objects for int values), some of which are shared (referred to by multiple
names)
5. Predict what the following script will produce and explain why.
print(print(5))
print=1
print(print)
6a. Write a simple function named count that returns the number of times a value
is in a list; write the a simple function named indexes that returns a list of
indexes in a list that a value returns. Use the appropriate kind of for loop.
For example, count(5, [5,3,4,5,1,2,5]) returns 3; indexes(5, [5,3,4,5,1,2,5])
returns [0,3,6].
7. Suppose that we define the functions double, triple, and times10 (as done
above). Write the function call, such that call('double',5) returns the result
double(5); call('triple',5) returns the result triple(5); call('magnitude',5)
returns the result magnitude(5). Hint: use eval.
8. Write a function named between that is defined with two parameters. It
returns a reference to a function that has one parameter, which returns whether
or not its one parameter is between (inclusive) the two arguments supplied when
between is called. For example
college_age = between(18,22)
print( college_age(20) )
print True because 18 <= 20 <= 22.
9. Assume s = 'Fortunate'. Explain how Python evalues s.replace('t','c'). Sure,
the result it produces is 'Forcunace', but exactly how does Python know which
function to call and how to call that function with these arguments. Hint: Use
the Fundamenal Equation of Object-Oriented Programming.
9.5 This is tricky: it requires a good understanding of exec, eval, and what
characters really appear in strings when you type them on the console.
(1) prompt the user to enter a string that defines a function (using \n where
new lines would be in the function); (2) use exec to define the function;
(3) prompt the user to enter a call to the function and print what it evaluates
to. The interaction might look like:
Enter function definition as string: def f(n):\n return 2*n
Enter function call as string : f(3)
6
Hint: when you enter \n in a string, what characters are entered? Use the
replace function to "fix" them to exec will work.
10. Assume that you have a list of tuples, where each tuple is a name and
birthday: e.g., ('alex', (9, 4, 1988)) and ('mark', (11, 29, 1990)). The
birthday 3-tuple, consists of a month, followed by day, followed by year. Write
a for-loop using sorted and a lambda to print out the tuples in the list in
order of their bithdays (just months and days) so the 'alex' tuple prints
before the 'mark' tuple because September 4th comes before November 29th; all
people who have the same birthday should be printed in alphabetical order.
Hint write a lambda that uses a key that is a person's month value, followed by
a day value, followed by a name value.
11. What does the following script print?
print('a','b','c',sep='.-x-.')
print('d','e','f',sep='')
print('g','j','i',sep=':',end='..')
print('j','k','l',sep='--',end='?')
print('m',end='\n\n')
print('n')
12. Assume s is a string. What is the value of s[-1:0:-1]? Assume l is a list.
Write the simplest loop that prints all values in a list except the first and
last (if the list has2 or fewer values, it should print nothing).
13. Write a single Python statement using a conditional expression that is
equivalent to the following two statementso
t= 0
if x < 0:
t = -1
14. What can we say about
len of set(d.keys()) compared to len of d.keys?
len of set(d.values()) compared to len of d.values()?
len of set(d.items()) compared to len of d.items()?
15. Assume we import the copy function from the copy module. What is the
difference between the result produced by list((1,2,3)) and copy((1,2,3))?
15.5 Using the kind of pictures dicussed in the Binding section above,
illustrate the meaning of the following and determine what is printed.
x = [ [0], [1]]
y = list(x)
x[0][0] = 'a'
print(x,y)
16a. Assume we have a list of students (ls) and a list of their gpas (lg).
Create a dictionary whose first key is the first student in ls and whose
associated value is the first gpa in the lg; whose second key is the second
student in ls and whose associated value is the second gpa in the lg; etc.
So if ls = ['bob','carol','ted','alice'] and lg = [3.0, 3.2, 2,8, 3.6] the
resulting dict might print as {'carol': 3.2, 'ted': 2, 'alice': 8, 'bob': 3.0}.
Hint: use the dict constructor and the zip function.
16b. Assume that we have a list of runners in the order they finished the race.
For example ['bob','carol','ted','alice']. Create a dictionary whose keys are
the students and whose values are the place in which they finished. For this
example the resulting dict might print as
{'carol': 2, 'ted': 3, 'alice': 4, 'bob': 1}. Hint: use a comprehension and
enumerate.
16c. Assume that we have a list of values l and a function f, and we want to
define a function that computes the value x in l whose f(x) is the smallest.
For example, if l = [-2, -1, 0, 1, 2] and def f(x) : return abs(x+1), then
calling min_v(l,f) would return -1. Hint: try to write the min_v function in one
line: a returns statement calling min, on a special comprehension, and indexing.
17. The following script uses many topics that are covered in the lecture.
Write a script that reads a multiline file of words separated by spaces
(no punctuation) and builds a dictionary whose keys are the words and whose
values are lists of the line numbers that the words are on (with no duplicate
line numbers in each list). Print all the words (in sorted order, one per line)
with the list of their line numbers afterwards. For example, the 3 line file
to be or
not to be
that is the question
would print as
be [1, 2]
is [3]
not [2]
or [1]
question [3]
that [3]
the [3]
to [1, 2]
My solution was 8 lines long (including one import). It used a defaultdict,
three loops, three function calls (open, enumerate, and sorted), and four
method calls (rstrip, split, append).


Source code for jobport.storage
# //=======================================================================
# // Copyright JobPort, IIIT Delhi 2015.
# // Distributed under the MIT License.
# // (See accompanying file LICENSE or copy at
# // http://opensource.org/licenses/MIT)
# //=======================================================================
# __author__ = 'naman'
from django.core.files.storage import FileSystemStorage
from django.conf import settings
import os
[docs]class OverwriteStorage(FileSystemStorage):
[docs] def get_available_name(self, name):
"""Returns a filename that's free on the target storage system, and
available for new content to be written to.
Found at http://djangosnippets.org/snippets/976/
This file storage solves overwrite on upload problem. Another
proposed solution was to override the save method on the model
like so (from https://code.djangoproject.com/ticket/11663):
def save(self, *args, **kwargs):
try:
this = MyModelName.objects.get(id=self.id)
if this.MyImageFieldName != self.MyImageFieldName:
this.MyImageFieldName.delete()
except: pass
super(MyModelName, self).save(*args, **kwargs)
"""
# If the filename already exists, remove it as if it was a true file system
if self.exists(name):
os.remove(os.path.join(settings.MEDIA_ROOT, name))
return name


The Rolling Window Tool
Rolling window analysis is a method for tracing the frequency of terms within
a designated window of tokens over the course of a document. It can be used
to identify small- and large-scale patterns of individual features or to compare
these patterns for multiple features. Rolling window analysis tabulates term
frequency as part of a continuously moving metric, rather than in discrete
segments. Beginning with the selection of a window, say 100 tokens, rolling
window analysis traces the frequency of a term's occurrence first within
tokens 1-100, then 2 to 101, then 3, 102, and so on until the end of the
document is reached. The result can be plotted as a line graph so that it
is possible to observe gradual changes in a token’s frequency as the text
progresses. Plotting different tokens on the same graph allows us to compare
their frequencies.
Usage
- Generate
After selecting the options described below click "Generate" to see your
Rolling Windows graph. Note: The Rolling Windows tool requires
that there is only one active document. Visit the Manage page
to activate your desired document and deactivate the rest.
- Plotly Menu
If you pan over the graph, you'll notice that a menu appears in the top
right corner.
- Zoom: This option allows you to click and drag to zoom in to a
specific part of the graph.
- Pan: This option will change the click and drag function to
panning across the graph.
- Zoom in and Zoom out: These will automatically zoom to the center
of the graph.
- Auto-scale and Reset Axis: These options will zoom all the way out
with the axis reset to fit the window
- Toggle spike lines: This option allows you to hover your mouse
over data points and see where they are aligned on the x-axis and
y-axis
- Show closest data on hover: If you hover over a data point,
this option will show you the value of the data point (the average
or ratio at that point in the window).
- Compare data on hover: If you hover over a data point, this
option will show you the value of the data point and it's corresponding
x-axis value (the location of the term in the token sequence
(starting from 0), along with the average or ratio at that point in the window).
Options
- Calculation Type
Lexos will plot either the average term frequency in each window (Rolling
Average) or the ratio of term frequencies if you are examining multiple terms
(Rolling Ratio). If you choose Rolling Ratio, you must enter two terms
(top / bottom); the plot will show the ratio of these terms in each window.
- Search Terms
These are the terms you wish to plot from your document. Enter up to 6
terms, separated by commas. When Lexos searches your document for these
terms, it uses the document text, rather than the Document-Term Matrix
(DTM) as its starting point. This means that you can choose to search
for strings of text, individual words or terms (separated by spaces),
or regular expressions (regex). A basic tutorial for using regex can be
found at https://regexone.com/.
When searching for patterns as Strings, do not include extra spacing
between your strings. For example, if you are searching for "il" and "on",
enter the two strings to search for without a space after the comma,
as follows: il,on
. Again, when searching for multiple Strings,
separate each string by only a comma with no whitespace. Any entered whitespace
will be included in the search, probably not what you intended.
- Window
This is where you set the size of the window you want to use. It can
consist of any number of characters, tokens (separated by spaces), or lines
(separated by line breaks in the text).
- Display
If your document contains milestones, click the checkbox, enter your
milestone, and the location of each milestone will be indicated on the
rolling window graph by a vertical line.
The Show Individual Points option (turned off by default) produces an
uninterrupted line graph. Turning this option on will show the points where
each term occurs in the document.
The Black and White option produces a non-color version of the graph
that is suitable for downloading and publishing in journals.
- Download
The Rolling Windows graph is downloadable in either .svg
or
.png
format. SVG images are very useful because they scale
well in web browsers.
To download the graph as a data file, click the CSV button and you will get a
results .csv
file. “CSV” is short for Comma-Separated Values.
In your downloaded file, a comma will serve as the column delimiter and
these files can be opened by other programs later, e.g., Excel.
- Example


|
Drake
|
Both truncation and rounding errors can prevent constraints from being exactly satisfied.
For example, consider the bilateral holonomic constraint equation gₚ(t,q) = 0. Even if gₚ(t₀,q(t₀)) = ġₚ(t₀,q(t₀),v(t₀)) = g̈ₚ(t₀,q(t₀),v(t₀),v̇(t₀)) = 0, it is often true that gₚ(t₁,q(t₁)) will be nonzero for sufficiently large Δt = t₁ - t₀. One way to address this constraint "drift" is through dynamic stabilization. In particular, holonomic unilateral constraints that have been differentiated twice with respect to time can be modified from:
0 ≤ g̈ₚ ⊥ λ ≥ 0
to:
0 ≤ g̈ₚ + 2αġₚ + β²gₚ ⊥ λ ≥ 0
and holonomic bilateral constraints can be modified from:
g̈ₚ = 0
to:
g̈ₚ + 2αġₚ + β²gₚ = 0
for non-negative scalar α and real β (α and β can also represent diagonal matrices for greater generality). α and β, which both have units of 1/sec (i.e., the reciprocal of unit time) are described more fully in [Baumgarte 1972]. The use of α and β above make correcting position-level (gₚ) and velocity-level (gₚ̇) holonomic constraint errors analogous to the dynamic problem of stabilizing a damped harmonic oscillator. Given that analogy, 2α is the viscous damping coefficient and β² the stiffness coefficient. These two coefficients make predicting the motion of the oscillator challenging to interpret, so one typically converts them to undamped angular frequency (ω₀) and damping ratio (ζ) via the following equations:
ω₀² = β² ζ = α/β
To eliminate constraint errors as quickly as possible, one strategy used in commercial software uses ζ=1, implying critical damping, and undamped angular frequency ω₀ that is high enough to correct errors rapidly but low enough to avoid computational stiffness. Picking that parameter is considered to be more art than science (see [Ascher 1995]). Given desired ω₀ and ζ, α and β are set using the equations above.


When people come to the UK to live or visit, they often have to use local or national government websites for information on a range of topics. It is also possible to find some of this information from non-government sources. If English is not their first language, it may be difficult to know where to go, and what information is useful or that can be trusted as being correct. Therefore, I am interested in how people who speak English as a second language find information on governmental topics using the internet.
This study aims to look at the information seeking skills of the people who take part to help in the design of websites and their content (for example www.gov.uk), search engines (like Google) and to improve teaching of IT and digital literacy skills.
To understand the information needs of the people who help in this study, and English as second language users in general, this study includes an experiment and a few questionnaires. The information that will be collected in the questionnaires include details of age, occupation, language skills, I.T and Information Literacy levels. As well as the collection of personal opinions on the experiences and views about the tasks carried out in the study. The experiment will be conducted at Northumbria University, using PC's. You will have four tasks to complete. Each task includes a story in which people are facing a real-life issue that requires searching information from the internet. Your task will be to search for webpages that best answer this issue.
This study has been ethically approved by the Engineering and Environment ethical coordinator at Northumbria University.
In line with the Data Protection Act 2018 all participants can:
Mr David Brazier.
<EMAIL_ADDRESS>All participants in this study have a right to confidentiality, as such all efforts will be made to uphold this. In publication, any personal information provided by the participants will be anonymised by replacing their names with 'Participant A', etc. Any physical and digital data will be stored and destroyed securely, and retained for only as long as is required, in line with Northumbria Universities regulations.


| DOSE: |
100 mg |
oral |
MDMA |
(powder / crystals) |
This experience took place on 2001 summer vacations. I was in a camping park with some friends of mine. We had a vast supply of weed and some grams of coke, but I also took 1/2 gram of pure MDMA (in crystal form) withouth the knowledge of my friends. I was saving it for some special ocasion, and the oportunity came in the 4th day. We met a group of girls who were camping in the park. We went out to a bar, had some nice conversations, smoked a few joints... let's just say we got along pretty well. I was particulary atracted to one of them, a divinely beautiful blonde girl. I spent some time alone with her in my tent, and she asked me if I could get her some pills. That was the oportunity! I said I had something a lot better than pills, pure crystals of MDMA. She was very interested in taking some with me, so we decided to go out for a walk at night, to the beach, just the two of us.
At dinner, we ate only a light vegetable soup at a restaurant and went to my tent. I split the crystals in 5 nearly equal parts, crushed 2 into powder and wraped it in some paper. Each one of us swallowed 1, and we went to the city. It didn't took 20 minutes to hit me. I began to feel a little nauseated and uncomfortable, but this feeling wore off quickly and I began to feel the blissful efect of MDMA, pretty strongly: strong body waves, energy and that lovely feeling of empathy. She was feeling nothing at the time, but 10 minutes later it hit her.
We were both happy and euphoric, smiling and laughing a lot when we finally reached the beach. We took off our shoes and started walking on the sand. The tactile sensation on my foot was awesome, the sand seemed like a very soft thing, like walking in velvet. I was feeling quite floaty at the time as well, but the real high began when we both sat down on the sand and begun to talk about our lives. I told all my life problems to a girl I had met a couple days before, and so did she. I wouldn't do this at all if I was sober, I am a pretty reservated person, but at that time, it didn't matters, I trusted her more than I would trust my best friend if I was sober. She also told me her problems, and I hugged her and said 'não te preocupes, não importa o que aconteça, estarei sempre ao teu lado, para sempre' ('don't worry, no matter what happens I will always be on your side, forever' in portuguese :) ). That was intended by both of us as a declaration of love, and we kissed.
That was probably the most intense sensation I have ever felt, her lips touching mine, it was an indescribable feeling, believe me. I felt truly in love with that girl, like I'd never felt before. She was the most beautiful and wonderful person in the world to my eyes. We both said we loved each other very very much. For the next 4 hours, we kept walking on the beach, sitting on the sand, having deep personal conversations and kissing and licking each other.
But when the effects started to wear off, things got tense between us. I began to realise I had told things that I wouldn't tell to anybody (except for my very best friend) to a stranger, and I think she also thought the same. We stoped talking, and just stared to each other. I was depressed because of the drug comedown and because I had sworn eternal love to a person that I didn't love, the intense love feeling betwen was nothing but an ilusion created by the drug. I got up and said that it was better to go to the camping park again, and she agreed. Fortunatly, on our way, she started to talk about what happened, and we both agreed that we felt nothing but a physical atraction by each other, and that we should forget that night.
I've never seen her again since. I must admit, I never felt such a magic feeling like that night, it was far better than my first time (which was in a club), but be warned: when you do MDMA you may easily misjudge your feelings. I won't take it again with a girl, unless I love her for real
P.L.U.R. [[[]]]
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Keyboard routines
These functions are declared in the main Allegro header file:
#include <allegro5/allegro.h>
ALLEGRO_KEYBOARD_STATE
typedef struct ALLEGRO_KEYBOARD_STATE ALLEGRO_KEYBOARD_STATE;
This is a structure that is used to hold a "snapshot" of a keyboard's state at a particular instant. It contains the following publically readable fields:
- display - points to the display that had keyboard focus at the time the state was saved. If no display was focused, this points to NULL.
You cannot read the state of keys directly. Use the function al_key_down.
Key codes
The constant ALLEGRO_KEY_MAX is always one higher than the highest key code. So if you want to use the key code as array index you can do something like this:
bool pressed_keys[ALLEGRO_KEY_MAX];
...
pressed_keys[key_code] = true;
These are the list of key codes used by Allegro, which are returned in the event.keyboard.keycode field of the ALLEGRO_KEY_DOWN and ALLEGRO_KEY_UP events and which you can pass to al_key_down:
ALLEGRO_KEY_A ... ALLEGRO_KEY_Z,
ALLEGRO_KEY_0 ... ALLEGRO_KEY_9,
ALLEGRO_KEY_PAD_0 ... ALLEGRO_KEY_PAD_9,
ALLEGRO_KEY_F1 ... ALLEGRO_KEY_F12,
ALLEGRO_KEY_ESCAPE,
ALLEGRO_KEY_TILDE,
ALLEGRO_KEY_MINUS,
ALLEGRO_KEY_EQUALS,
ALLEGRO_KEY_BACKSPACE,
ALLEGRO_KEY_TAB,
ALLEGRO_KEY_OPENBRACE, ALLEGRO_KEY_CLOSEBRACE,
ALLEGRO_KEY_ENTER,
ALLEGRO_KEY_SEMICOLON,
ALLEGRO_KEY_QUOTE,
ALLEGRO_KEY_BACKSLASH, ALLEGRO_KEY_BACKSLASH2,
ALLEGRO_KEY_COMMA,
ALLEGRO_KEY_FULLSTOP,
ALLEGRO_KEY_SLASH,
ALLEGRO_KEY_SPACE,
ALLEGRO_KEY_INSERT, ALLEGRO_KEY_DELETE,
ALLEGRO_KEY_HOME, ALLEGRO_KEY_END,
ALLEGRO_KEY_PGUP, ALLEGRO_KEY_PGDN,
ALLEGRO_KEY_LEFT, ALLEGRO_KEY_RIGHT,
ALLEGRO_KEY_UP, ALLEGRO_KEY_DOWN,
ALLEGRO_KEY_PAD_SLASH, ALLEGRO_KEY_PAD_ASTERISK,
ALLEGRO_KEY_PAD_MINUS, ALLEGRO_KEY_PAD_PLUS,
ALLEGRO_KEY_PAD_DELETE, ALLEGRO_KEY_PAD_ENTER,
ALLEGRO_KEY_PRINTSCREEN, ALLEGRO_KEY_PAUSE,
ALLEGRO_KEY_ABNT_C1, ALLEGRO_KEY_YEN, ALLEGRO_KEY_KANA,
ALLEGRO_KEY_CONVERT, ALLEGRO_KEY_NOCONVERT,
ALLEGRO_KEY_AT, ALLEGRO_KEY_CIRCUMFLEX,
ALLEGRO_KEY_COLON2, ALLEGRO_KEY_KANJI,
ALLEGRO_KEY_LSHIFT, ALLEGRO_KEY_RSHIFT,
ALLEGRO_KEY_LCTRL, ALLEGRO_KEY_RCTRL,
ALLEGRO_KEY_ALT, ALLEGRO_KEY_ALTGR,
ALLEGRO_KEY_LWIN, ALLEGRO_KEY_RWIN,
ALLEGRO_KEY_MENU,
ALLEGRO_KEY_SCROLLLOCK,
ALLEGRO_KEY_NUMLOCK,
ALLEGRO_KEY_CAPSLOCK
ALLEGRO_KEY_PAD_EQUALS,
ALLEGRO_KEY_BACKQUOTE,
ALLEGRO_KEY_SEMICOLON2,
ALLEGRO_KEY_COMMAND
Keyboard modifier flags
ALLEGRO_KEYMOD_SHIFT
ALLEGRO_KEYMOD_CTRL
ALLEGRO_KEYMOD_ALT
ALLEGRO_KEYMOD_LWIN
ALLEGRO_KEYMOD_RWIN
ALLEGRO_KEYMOD_MENU
ALLEGRO_KEYMOD_ALTGR
ALLEGRO_KEYMOD_COMMAND
ALLEGRO_KEYMOD_SCROLLLOCK
ALLEGRO_KEYMOD_NUMLOCK
ALLEGRO_KEYMOD_CAPSLOCK
ALLEGRO_KEYMOD_INALTSEQ
ALLEGRO_KEYMOD_ACCENT1
ALLEGRO_KEYMOD_ACCENT2
ALLEGRO_KEYMOD_ACCENT3
ALLEGRO_KEYMOD_ACCENT4
The event field 'keyboard.modifiers' is a bitfield composed of these constants. These indicate the modifier keys which were pressed at the time a character was typed.
al_install_keyboard
bool al_install_keyboard(void)
Install a keyboard driver. Returns true if successful. If a driver was already installed, nothing happens and true is returned.
See also: al_uninstall_keyboard, al_is_keyboard_installed
al_is_keyboard_installed
bool al_is_keyboard_installed(void)
Returns true if al_install_keyboard was called successfully.
al_uninstall_keyboard
void al_uninstall_keyboard(void)
Uninstalls the active keyboard driver, if any. This will automatically unregister the keyboard event source with any event queues.
This function is automatically called when Allegro is shut down.
See also: al_install_keyboard
al_get_keyboard_state
void al_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state)
Save the state of the keyboard specified at the time the function is called into the structure pointed to by ret_state.
See also: al_key_down, ALLEGRO_KEYBOARD_STATE
al_key_down
bool al_key_down(const ALLEGRO_KEYBOARD_STATE *state, int keycode)
Return true if the key specified was held down in the state specified.
See also: ALLEGRO_KEYBOARD_STATE
al_keycode_to_name
const char *al_keycode_to_name(int keycode)
Converts the given keycode to a description of the key.
al_set_keyboard_leds
bool al_set_keyboard_leds(int leds)
Overrides the state of the keyboard LED indicators. Set to -1 to return to default behavior. False is returned if the current keyboard driver cannot set LED indicators.
al_get_keyboard_event_source
ALLEGRO_EVENT_SOURCE *al_get_keyboard_event_source(void)
Retrieve the keyboard event source.
Returns NULL if the keyboard subsystem was not installed.


TO LIVE A film review by Steve Rhodes Copyright 1996 Steve Rhodes
RATING (0 TO ****): ****
TO LIVE is an incredible story of life in Communist China from the beginnings of Mao's revolutionary victory through the Great Leap Forward and the Cultural Revolution and ending with ascendancy of the Red Guard. It is all told with the story of a single working class family with the husband played by Ge You and the wife by Gong Li.
The movie is divided by decades. Each of the three decades (40s, 50s, and 60s) in turn covers only a small time slice of the decade so that in the end you feel like the husband and wife are old friends that you have known for a long time and that, moreover, you know them extremely well. The script's layout and the brilliant writing make this possible.
 His only passion and the only talent he has is his hobby of singing during shadow puppet performances. Soon, however, he is swept into the throws of the revolution. Throughout the show his puppet singing provides both a metaphor for the spirit of each decade and his constant solace.
I have never seen a more anti-Communist movie. The horrors of this ideology were everywhere. When they are ordered to give up all of their cooking utensils in order that the entire village could make the equivalent of three cannon balls, the people are told not to worry because Communism will provide for them.
In another example of the horrors of the time, the Red Guard takes over the hospital and throws out all of the doctors and nurses since they are old and counter-revolutionary. In their place, they have young students attempt to guess at what to do for sick people. Suffice it to say that it did not work.
In every decade, as their standard of living gets worse, they still believe that it will be good someday. It was not a very safe time to be alive either. If you were of working class stock, if you managed never to get to be a party official, and if you laid low and agreed to do whatever the party said and hate whomever the party said to hate including your (ex-)friends, then and only then did you stand much chance of survival.
The movie, however, uses the backdrop of Communism more as a way to explain the harsh living conditions of the family. This show is about family love more than anything else. If your family could survive this and be not only in tact, but happy, then it is a strong family indeed!
There are a couple of devastatingly awful tragedies that strike this family. It is easy to cry they are so terrible, and yet the film is never manipulative. I am glad the horrors were shown since it made their ability to smile at adversity seem even more amazing.
I know it will never happen, but Ge You deserves an academy nomination and maybe the award as well. To say his performance was moving is a gigantic understatement. Although Gong Li was not quite as good, hers was an outstanding performance. The movie is so real that you had to pinch yourself to remember it was not a documentary.
If you liked The Joy Luck Club, then you should love this since it is an order of magnitude better made and more realistic. TO LIVE was one of the most life affirming movies of the year.
TO LIVE is in Mandarin with easy to follow English subtitles. It runs 2:13 which is just about perfect although it was good enough to make it a 6 hour movie in my opinion. I recommend everyone over the age of about 10 see it. It is unrated, but I suspect it would be rated PG-13 for some scenes of violence. There is no sex, nudity, or bad language. I give it my top rating of ****.
**** = One of the top few films of this or any year. A must see film. *** = Excellent show. Look for it. ** = Average movie. Kind of enjoyable. * = Poor show.  Totally unbearable.
REVIEW WRITTEN ON: December 27, 1994
Opinions expressed are mine and not meant to reflect my employer's.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Top 13 Christmas gifts 2019: Most popular presents flying off the shelves this year
by Precious AdesinaIf you've exhausted all of your Christmas gift ideas, but still have a few people on the Christmas shopping list you need to buy for, then it may be time to turn to the experts.
Who else knows about gifts better than the people who make those options available to you every year, especially those at some of our favourite stores.
We've spoken to the curators, buyers and those on the seasonal team of some of the big retailers to find out what they think will be popular this year and why you should get these items for the special people in your life this Christmas.
For her
1. Lina Green Gin Glasses
Molly Park, Home & Gift Design at Oliver Bonas
"Forget Prosecco – toast the festive season with a G&T. Our Lina Gin Glasses feature a flower motif on the stem."
2. Jana Reinhardt Jewellery Family Birthstone Spinning Universe Necklace
Francesca Pittaway, Head Curator at Not On The High Street
"It is of no surprise to us that this beautiful spinning pendant is proving popular with our customers - it is handmade to order in the UK and incorporates the birthstones of your loved ones to represent those in your life that are your whole universe. It can feature up to 10 birthstones which are available in different sizes, and spins to reveal a personalised message, making each one completely unique and bespoke to the customer."
Read our guide on the best Christmas gifts for her.
Mums
3. Personalised Veuve Clicquot Arrow Tin
Terry Threlfall, Wine & Spirits Buyer at Selfridges
“Our limited edition Veuve Clicquot arrow tins are proving really popular. Champagne is a failsafe gift idea and going the extra mile to get it personalised makes it extra special. The metallic tin can be treasured long after the bottle has been enjoyed.”
4. Fiore Gold Brass & Mango Wood Dressing Table
Molly Park, Home & Gift Design at Oliver Bonas
"Christmas is all about celebrating and creating a sense of festivity and opulence into your home. Gold is the colour of luxe and our Fiore range creates drama and insta-worthy scenes."
Read our guide for more inspiration on what to buy mum for Christmas this year.
For him
5. Duncan Stewart Personalised Weekend Holdall
Francesca Pittaway, Head Curator at Not On The High Street
"This personalised weekend holdall is such a popular gift for him and the perfect item for someone who travels regularly. It’s a really classic style, high quality, durable and the tastefully embroidered initials add that personal touch."
6. Combekk Thermometer Dutch Oven
Emma Lay, Partner & Cookshop Assistant Buyer at John Lewis & Partners
"Made from 100% recycled disused iron railway tracks, this is the perfect gift for the environmentally conscious cook. It has an integrated thermometer which will give your cooking confidence this festive season to ensure you achieve culinary excellence every time."
Read our guide on the best Christmas gifts for him.
Dads
7. Portable Cake Decorating Airbrush Kit
Bethany Stebbens at Lakeland
"If you know someone whose bakes are always beautifully presented, this kit makes a lovely gift to expand their cake decorating repertoire and make ever-more elegant confections to grace party tables and celebrations."
8. Umi by Amazon Wireless Earbuds
Shibu Tharakan at Umi by Amazon
"Customers appreciate the sound quality and the value of Umi by Amazon true wireless earphones. They are durable and simple to use, water resistant and have a long-lasting battery. They are highly recommended and a must-have in the affordable category of true wireless earphones."
Check out our guide for more Christmas gift ideas for dad this year.
Kids
9. Personalised Memory Suitcase Keepsake Box Gift Set
Francesca Pittaway, Head Curator at Not On The High Street
"The keepsake memory suitcase sells consistently well and is much loved by our customers because of it’s high quality finish and the fact that items that hold precious memories of a newborn or an event can be kept safe in a stylish and timeless way - a real heirloom piece that you won’t want to store away in the loft! It’s available in different colours and you can add a personalised luggage tag to really complete the item too."
10. My Buddy Wheels Unicorn
£70, Halfords
Emma Dines, Buyer at Halfords
“Many children find it easier to learn to ride on a balance bike than using stabilisers, and these Insta-worthy designs cleverly disguise a lightweight bike. Toddlers will have so much fun with their little buddy that learning to ride will be effortless.”
Buy it now
Read our guide on the best Christmas gifts for kids.
Teens
11. Smartech LARQ self-cleaning bottle
Charlotte Thornes, Buyer at Selfridges
"One of our top picks this Christmas is the Larq water bottle. Not only is it reusable, but both the water and bottle can be digitally purified at the touch of a button, neutralising 99.9% of harmful odour-causing germs. What’s more, it is double insulated, keeping water cold for 24 hours or hot for 12 hours."
12. Madam Stoltz Mademoiselle Marietta Vase
Lucy Ward, Creative Brand Director at Trouva
"This ceramic vase with it's cheerful painted face from Madam Stolz is perfect for your eccentric best friend. Fill it with brightly coloured flowers and it's sure to become the talking point of any room."
Read our guide on the best Christmas gifts for teenagers.
The product that sums up Christmas
13. Apple AirPods with Charging Case
Lucy Spratley, Partner and Tech Buyer at John Lewis & Partners
"Apple AirPods were one of the most popular gifts last year and we expect them to be this year too. They're packed with loads of functionality and look great too. This latest version has Siri built in and you can wirelessly charge them."
For more Christmas features and gift guides, see www.telegraph.co.uk/christmas
The Telegraph makes a small amount of money by adding affiliate links to products mentioned in this article. All products are picked independently by our journalists.


Time is: {{mytime | date:'shortTime' }}
Hours step is:
{{opt}}
Minutes step is:
{{opt}}
12H / 24H
Set to 14:00
Clear


Bacon ipsum dolor amet biltong short ribs cupim brisket, prosciutto flank t-bone ball tip porchetta sirloin.
Leberkas jerky kevin doner pork loin ground round landjaeger chicken ham hock brisket bresaola shankle.
Alcatra doner pastrami salami. Does your lorem ipsum text long for something a little meatier?
Alcatra doner pastrami salami. Does your lorem ipsum text long for something a little meatier?


Module contents¶
Short library to count substrings in binary files and measure performance
myparser.argparser module¶
Library that gets and processes the arguments given by the user
-
myparser.argparser.
get_args
()¶ Function that reads the argument input. Returns the arguments
Returns: Object containing file path, encoding and min length Return type: object
-
myparser.argparser.
validate_args
(decoding_args)¶ Function that verifies if the arguments values are valid
Returns: ‘True’ if ok else ‘False’ Return type: bool
myparser.performance module¶
Library that compares performance between substring finding functions
-
myparser.performance.
measure_performance
(encoding, min_substring_len, times_to_avg, len_list, functions)¶ Function that given an encoding, a minimum substring length, the number of times to get an average value, the string length iterator, and the functions to compare measures the time required to find the substrings
Parameters: - encoding (str) – Encoding method
- min_substring_len (int) – Minimum substring length in characters
- times_to_avg (int) – Number of times to get average
- len_list (list) – List of string length values
- functions (list) – List of functions to test
myparser.stringparser module¶
Library that gets substrings repetition using parameters
-
myparser.stringparser.
get_substrings_repetitions_dict
(file_to_decode, encoding, min_substring_len)¶ Function that parses a UTF-X file to find substrings repeated more than once, with a length greater than the minimum substring size parameter using a dictionary
Parameters: - file_to_decode (file) – File to decode
- encoding (str) – Encoding method
- min_substring_len (int) – Minimum substring length in characters
Returns: Dictionary with the substring as key and the number of occurrences as value
Return type: dict
-
myparser.stringparser.
get_substrings_repetitions_set
(file_to_decode, encoding, min_substring_len)¶ Function that parses a UTF-X file to find substrings repeated more than once, with a length greater than the minimum substring size parameter using a set
Parameters: - file_to_decode (file) – File to decode
- encoding (str) – Encoding method
- min_substring_len (int) – Minimum substring length in characters
Returns: Dictionary with the substring as key and the number of occurrences as value
Return type: dict


| Home | Trees | Indices | Help |
|
|---|
|
|
object --+ | modeling._NexusMember --+ | object --+ | | | modeling._ComputeModelComponents --+ | modeling.ModelBase --+ | ConfigModel
Base class for all config models.
This class is used to define Actuator config models. Instances of the class will be married to a namespace such that the model can find the Roles associated with each task. Once an instance is made and associated with a namespace the tasks in the model can be peformed.
|
|||
| __metaclass__ | |||
|
ref_class Instances of this class are created when accessing attributes on a model class instance. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
| Inherited from modeling.ModelBase | |||
|---|---|---|---|
|
|||
|
|||
| Inherited from modeling._NexusMember | |||
|
|||
| Inherited from modeling._ComputeModelComponents | |||
|
|||
|
|||
|
|
|||
|
|
|||
__config_options__ =
|
|||
_node_dict =
|
|||
q = <actuator.modeling.RefSelectBuilder object at 0x7feca15eae90>
|
|
|||
|
Inherited from |
|
Create a new ConfigModel derived class instance. Create an instance of a config model. You may override this method as long as you call super().__init__() in your init and pass along all the keyword arguments that were passed into your derived class.
|
Compute the remote user to use for a task. This returns the remote_user specified on this object, or returns the remote_user from the delegate if there is no remote_user and there is a delegate. If a remote_user can't be determined, the current user is used for the remote user. |
Compute the remote_pass to use for the remote_user. Return the remote_pass on this object, or if there isn't one and there is a delegate, return the delegate's remote_user. NOTE: I have yet to see Ansible process this option properly even with sshpass installed; Ansible fails with a BROKEN PIPE error on the sshpass command. For the time being use the private_key_file option for login credentials instead. |
Compute the private_key_file to use for the remote_user. Return the private_key_file on this object, or if there isn't one and there is a delegate, return the delegate's private_key_file. |
Internal; sets the default_task_role for the model. Users generally don't need to use this method. |
Returns a NetworkX DiiGraph object consisting of the tasks that are in the model. The graph returned is a clean instance of the graph that governs the operation of configuration under the orchestrator. That means it has none of the additional information added by the orchestration system, such as what nodes have been performed or not. This method simply provides a means to acquire the graph for visualization or other information purposes.
|
Compute the IP address of the host for the task. This method takes the value returned by get_task_role. and returns a string that is the IP address for the value returned, if any. This does not take into account and run_from value. |
Compute the Role to use for as the default task_role for this model. This method computes the task_role, either from this model or from the model's delegate, and returns the actual Role object to use. |
Compute the Role to use as the default run_from Role for this model. This method computes the run_from Role to use for any tasks that don't have their own. If it can't determine a run_from and it has a delegate, it returns the delegates notion of the run_from Role. This returns an actual Role object, not a reference. |
Compute the IP address of the host where the task is to run from. This method computes the IP address of the IP address of the host for the Role returned by get_run_from, if there is one. If none, it returns None. |
Internal; sets the namespace to use for this config model so the model can determine what tasks to run where.
|
This method returns a list of _Dependency objects as defined on the config model object, *not* an instance of the config model. This means that there may be few dependencies than in an instance as there won't be a namespace yet to influence the number of tasks to perform. |
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Feb 9 18:19:51 2015 | http://epydoc.sourceforge.net |


--- layout: page title: "Privacy" permalink: /privacy/ main_image_path: "/assets/images/lauder.jpg" main_image_caption: "A quiet road for biking near the Spottiswoode estate, Lauder" frontpage: false homepage_description_markdown: frontpagetitle: images: - image_path: image_title: "" image_description: _options: layout: hidden: true permalink: hidden: true image_path: uploads_dir: "assets/images/:year" width: 1200 height: 1200 resize_style: contain mime_type: image/jpeg main_image_path: uploads_dir: "assets/images/:year" width: 1200 height: 1200 resize_style: contain mime_type: image/jpeg content: uploads_dir: "assets/:year" _comments: title: Page title main_image_path: Image used to represent your page frontpage: Show this page on the homepage homepage_description_markdown: Text used on homepage if shown frontpagetitle: Alternative title for home page use images: Add and edit images here ---
We respect your privacy. You'll find details here about what personal data we ask for, and what we do with it.


Please understand that we strive to give you the best reading experience possible. But there are limits to what we can do when your reading device does not conform to standards. You can help, too: choose a modern browser.
You will need to enable JavaScript to enjoy the interactive elements.


Atiku Mourns Death Of Close Personal Aide
by Oladipo AbiolaAtiku Loses Close Personal Aide
Alhaji Umar Pariya, better known as “Mr. Pee” a longstanding aide to former Vice President of Nigeria, Atiku Abubakar is dead.
He died on Tuesday, November 19 and has since been buried in accordance with Islamic rite.
A statement by the Atiku Media Office which was signed by Paul Ibe describes the death of the former Vice President’s Personal Assistant as sad and painful.
“He (Pariya) was a committed loyalist, a strong pillar of support in (my) life’s journeys and struggles in good, rough and uncertain times.
“He gave a good account of his service to the nation and association with my humble self, right from our days in the Department of Customs and Excise spanning over three decades.
He showed love and solidarity to me and my family and in the process became a member of my family”, the statement quoted Atiku as saying.
The former Vice President takes solace in the reality that Allah gives life and determines when He calls whomever He created.
 He was dear to many in high and low places. I will greatly miss him!”, Atiku said.
He prays to Almighty Allah to forgive Umar Pariya his sins and grant him Aljannah Firdaus.


I am a game designer who loves making game system/mechanics/gameplay, be either video game or board game. I use my design, writing and technical background to look at each part of the game and see how it affects the player's experience.
I like working in collaborative environments where everyone is passionate about what they do and are open to discuss and criticize any game design decision, regardless of the area they belong to.


Clan Management
Clan: {{ clan.name }}
Welcome Clan Leader, {{ playerClaims.username }}
Invite New Member
Failed to invite {{inviteMemberForm.value.playername}}
Pending Invites
| Player |
Sent |
Cancel |
|
{{ invite.sentAt | date:'short'}} |
|
Members
| Player |
Joined |
Kick |
|
{{stats.player.joinedClan | date:'short'}} |
|
Are you sure you want to kick {{kickSurePlayer.username}}?
Are you sure you want to leave {{clan.name}}?
Members
| Player |
Joined |
|
{{stats.player.joinedClan | date:'short'}} |
Are you sure you want to disband {{clan.name}}?
Register Clan
Clan name not available
Invites
Congrats on registering your clan: {{ clan.name }}!


| tennis.py |
16 |
1 |
0 |
94% |
| test_tennis.py |
4 |
1 |
0 |
75% |
| test_tennis_unittest.py |
8 |
6 |
0 |
25% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/__init__.py |
5 |
2 |
0 |
60% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/_code/__init__.py |
9 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/_code/code.py |
640 |
454 |
0 |
29% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/_code/source.py |
244 |
188 |
0 |
23% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/_io/__init__.py |
0 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/_io/saferepr.py |
52 |
40 |
0 |
23% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/_version.py |
1 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/assertion/__init__.py |
71 |
54 |
0 |
24% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/assertion/rewrite.py |
590 |
505 |
0 |
14% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/assertion/truncate.py |
49 |
40 |
0 |
18% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/assertion/util.py |
294 |
253 |
0 |
14% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/compat.py |
178 |
95 |
2 |
47% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/config/__init__.py |
655 |
533 |
0 |
19% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/config/exceptions.py |
3 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/config/findpaths.py |
107 |
93 |
0 |
13% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/debugging.py |
191 |
162 |
0 |
15% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/deprecated.py |
6 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/fixtures.py |
774 |
585 |
0 |
24% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/freeze_support.py |
17 |
15 |
0 |
12% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/hookspec.py |
56 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/main.py |
419 |
349 |
0 |
17% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/mark/__init__.py |
80 |
60 |
0 |
25% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/mark/legacy.py |
48 |
34 |
0 |
29% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/mark/structures.py |
170 |
87 |
0 |
49% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/nodes.py |
226 |
157 |
0 |
31% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/outcomes.py |
70 |
42 |
0 |
40% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/pathlib.py |
203 |
157 |
0 |
23% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/python.py |
788 |
644 |
0 |
18% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/python_api.py |
230 |
153 |
2 |
33% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/recwarn.py |
114 |
77 |
0 |
32% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/reports.py |
242 |
176 |
0 |
27% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/runner.py |
270 |
210 |
0 |
22% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/_pytest/warning_types.py |
36 |
2 |
0 |
94% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/__init__.py |
22 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/_compat.py |
82 |
36 |
11 |
56% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/_config.py |
9 |
4 |
0 |
56% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/_funcs.py |
79 |
55 |
0 |
30% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/_make.py |
694 |
231 |
0 |
67% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/_version_info.py |
36 |
10 |
0 |
72% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/converters.py |
27 |
19 |
0 |
30% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/exceptions.py |
16 |
4 |
0 |
75% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/filters.py |
15 |
9 |
0 |
40% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/attr/validators.py |
116 |
54 |
0 |
53% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/importlib_metadata/__init__.py |
214 |
82 |
2 |
62% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/importlib_metadata/_compat.py |
27 |
3 |
38 |
89% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/more_itertools/__init__.py |
3 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/more_itertools/more.py |
819 |
695 |
0 |
15% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/more_itertools/recipes.py |
131 |
98 |
0 |
25% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/packaging/__about__.py |
10 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/packaging/__init__.py |
3 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/packaging/_structures.py |
41 |
18 |
0 |
56% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/packaging/_typing.py |
3 |
1 |
3 |
67% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/packaging/version.py |
189 |
126 |
10 |
33% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/pluggy/__init__.py |
8 |
2 |
0 |
75% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/pluggy/_tracing.py |
41 |
30 |
0 |
27% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/pluggy/_version.py |
1 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/pluggy/callers.py |
122 |
102 |
0 |
16% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/pluggy/hooks.py |
175 |
128 |
0 |
27% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/pluggy/manager.py |
195 |
152 |
0 |
22% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/__init__.py |
14 |
6 |
0 |
57% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_builtin.py |
112 |
85 |
0 |
24% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_error.py |
52 |
38 |
0 |
27% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_io/__init__.py |
0 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_io/terminalwriter.py |
266 |
218 |
0 |
18% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_path/__init__.py |
0 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_path/common.py |
278 |
207 |
0 |
26% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_path/local.py |
690 |
574 |
0 |
17% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_vendored_packages/__init__.py |
0 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_vendored_packages/apipkg.py |
148 |
55 |
0 |
63% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/py/_version.py |
1 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/pytest/__init__.py |
48 |
0 |
0 |
100% |
| /Users/campdi7/Documents/Diego/Projects/py-pluralsight/pluralsight/lib/python3.7/site-packages/zipp.py |
113 |
65 |
0 |
42% |


Bodies of 26 Tezgam Express tragedy victims handed over to their heirs
by https://www.facebook.com/dunyanewsMIRPUR KHAS (Dunya News) - Bodies of 26 Tezgam Express tragedy victims, who were identified after DNA tests, have been handed over to their heirs in Mirpur Khas on Wednesday night, Dunya News reported.
A large number of relatives of the victims along with hundreds of local residents were present to receive the dead bodies of their loved ones. Two dead bodies were also shifted to Umar Kot.
Seventeen victims were identified on November 3. Three bogies of the Tezgam Express, which was heading from Karachi to Rawalpindi, caught fire on October 31 near Rahim Yar Khan. A total of 75 people were killed, either in the fire or from jumping out of the moving train. Forty people were injured.


First page
Back
Continue
Last page
Overview
Graphics
Wart exchange: eval in what scope?
function foo(a, b, c) {
return a(b);
}
foo(eval, 'c', 37);
ES3: Returns 37? unclear
ES5: An
indirect eval
. Uses global scope.
But introduces additional concept.