-
Notifications
You must be signed in to change notification settings - Fork 2
/
base_classes.py
82 lines (61 loc) · 2.04 KB
/
base_classes.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python
# Steven Phillips / elimisteve
# 2015.06.09
class ExPhil(object):
'''
Every ExPhil Object, Theory, ThoughtExperiment, etc -- probably
every class defined in any ExPhil argument -- should inherit from
this class (ExPhil).
'''
def __new__(cls, *args, **kwargs):
obj = object.__new__(cls, *args, **kwargs)
# TODO(elimisteve): Consider making this a custom dict-based type that
# warns us when replacing an existing key's value
obj.exphil_attrs = {}
return obj
class Object(ExPhil):
'''
Every object posited by any argument should inherit from this
class (Object).
'''
def __new__(cls, *args, **kwargs):
obj = ExPhil.__new__(cls, *args, **kwargs)
obj.exphil_attrs.update({
'type': 'Object',
})
return obj
class Theory(Object): # TODO(elimisteve): Inherit from Object, or no?
'''
Every (translation of a) philosophical theory defined should
inherit from this class (Theory).
'''
def __new__(cls, *args, **kwargs):
obj = Object.__new__(cls, *args, **kwargs)
obj.exphil_attrs.update({
'type': 'Theory',
})
obj.theory = {}
return obj
class ThoughtExperiment(ExPhil):
def __new__(cls, *args, **kwargs):
obj = ExPhil.__new__(cls, *args, **kwargs)
obj.exphil_attrs.update({
'type': 'ThoughtExperiment',
})
return obj
# TODO(elimisteve): Create TheoryOfLanguage(Theory), then
# TheoryOfNames(TheoryOfLanguage)?
# TODO(elimisteve): Instead call this TheoryOfReference?
class TheoryOfNames(Theory):
def __new__(cls, *args, **kwargs):
obj = Theory.__new__(cls, *args, **kwargs)
obj.exphil_attrs.update({
'type': 'TheoryOfNames',
})
# There are implicit assumptions made by most theories of names
obj.theory.update({
'names_refer': True,
})
return obj
def __init__(self, *args, **kwargs):
self.theory.update(kwargs)