-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
69 lines (60 loc) · 2.07 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python
# encoding: utf-8
"""
test.py
Created by Sam Cook on 2011-03-14.
Copyright (c) 2011 __MyCompanyName__. All rights reserved.
"""
import os
def main():
class A(object):
counter = 0
def __init__(self,):
A.counter += 1
a = A()
print A.counter
b = A()
print A.counter
# import matplotlib.pyplot as plt
# plt.figure(1) # the first figure
# plt.subplot(211) # the first subplot in the first figure
# plt.plot([1,2,3])
# plt.subplot(212) # the second subplot in the first figure
# plt.plot([4,5,6])
#
#
# plt.figure(2) # a second figure
# plt.plot([4,5,6]) # creates a subplot(111) by default
#
# plt.figure(1) # figure 1 current; subplot(212) still current
# plt.subplot(211) # make subplot(211) in figure1 current
# plt.title('Easy as 1,2,3')
# from sams_utilities import stall
# stall(30)
# if os.path.isfile("notes.txt"): print "hooray"
# bounds = [0, 2, 4, 6, 8, 10]
# dat = [0,0,0,0,6,6,6,6,9,9,2,2]
# bins = {0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0,}
# bounds.reverse()
# for point in dat:
# for bound in bounds:
# if (point >= bound):
# print point, bound, (len(bounds) - bounds.index(bound) - 1)
#
# bins[len(bounds) - bounds.index(bound) - 1] += 1
# break
# filters = {1:'a', 2:'hello', 3:['a', 'bc'], 'test':['12', 45]}
# for entry in filters.items():
# # loop over each key:value item
# try:
# # test if the item is iterable (exec strings)
# getattr(entry[1], '__iter__')
# except AttributeError:
# # if the filter is not iterable make it so
# print entry[0], entry[1]
# filters[entry[0]] = [entry[1], ]
#
# for i in filters.values():
# print type(i)
if __name__ == '__main__':
main()